UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionSCRIPT ERROR PLEASE HALP!! EmptySCRIPT ERROR PLEASE HALP!!

more_horiz
Im having some problems with c# please help

Line 26:
The name `playerTransform' does not exist in the current context
Line 28:
`UnityEngine.Vector2' does not contain a definition for `Find'
Line 29:
Cannot implicitly convert type `string' to `UnityEngine.UI.Text'
Line 30:
The name `HiScoreCount' does not exist in the current context
Line: 32:
The name `HiScoreCount' does not exist in the current context
Line 33:
The name `HiScoreCount' does not exist in the current context



Code:


using UnityEngine;
using System.Collections;
using UnityEngine.UI;

   public class ScoreManager : MonoBehaviour {
   
   
   public Text Hight;
   public Text HiScore;
   public Text Player;
   public float HightCount;






      void Start ()
   {
      
   }

   // Update is called once per frame
   void Update ()
   {
      Vector2 playerPos = playerTransform.position;

      HightCount = GameObject.Find("Player").transform.position;
      Hight = "" + HightCount;
      HiScore.text = "HiScore: " + HiScoreCount;

      if (HightCount > HiScoreCount) {
         HiScoreCount = HightCount;
      }
   }
}


Thanks <3

descriptionSCRIPT ERROR PLEASE HALP!! EmptyRe: SCRIPT ERROR PLEASE HALP!!

more_horiz
I'll fix the code for you.

Code:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

  public class ScoreManager : MonoBehaviour {
 
  public float HightCount;
  public Text Hight;
  public float HiScore;
  public Text HiScoreText;
  public Transform Player;
  public float HightCount;






      void Start ()
  {
     
  }

  // Update is called once per frame
  void Update ()
  {
      HightCount = Player.position.y;
      Hight.text = "" + HightCount;
      HiScoreText.text = "HiScore: " + HiScore;

      if (HightCount > HiScore) {
        HiScore = HightCount;
      }
  }
}
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply