Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » HELP » Help (General) » SCRIPT ERROR PLEASE HALP!!

SCRIPT ERROR PLEASE HALP!!

View previous topic View next topic Go down  Message [Page 1 of 1]

1 SCRIPT ERROR PLEASE HALP!! on Wed May 11, 2016 1:09 am

seventyD


Member [Lv. 0]
Member [Lv. 0]
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

View user profile

2 Re: SCRIPT ERROR PLEASE HALP!! on Fri May 13, 2016 8:19 am

DeveloperLuke


Moderator
Moderator
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;
      }
  }
}

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum