**Hi!** I'm following a *[tutorial][1]* (at 5:45 to 7:46) at a game example. Right now im doing the UI. In my version of unity there dosen't seem be an element/object called UI in the heirarchy, but there is one called GUI and they seem to be/look alike.
**My Code:**
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class Boll_kontroll : MonoBehaviour {
public float speed;
public Text countText;
private Rigidbody rb;
private int count;
void Start ()
{
rb = GetComponent ();
count = 0;
SetCountText ();
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag ("Pick Up")) {
other.gameObject.SetActive (false);
count = count + 1;
SetCountText ();
}
}
void SetCountText ()
{
countText.text = "count: " + count.ToString ();
}
}
Im getting the error code at the second line in the code, "using UnityEngine.UI;". It says "The type or namespace name 'UI' does not exist in the namespace 'UnitityEngine'".
I have tried to replace the '.Ui' in 'UnityEngine' with '.GUI' because i use GUI instead of Ui, that didn't work.
Thanks in before hand and sorry for my broken english.
[1]: https://unity3d.com/learn/tutorials/projects/roll-ball-tutorial/displaying-score-and-text?playlist=17141
↧