I was following the tutorial on roll-a-ball but when I got to the GUI set up I’m not able to just create a GUI text and drag it to my playerController script as shown in the video. I only see the create UI text option but that makes a Canvas and I’m unable to drop that into the playerController script. Is the Video out of date and how can I get my GUI counting points?
Sorry, that was harsher then needed. To use the UI you need add using UnityEngine.UI at the top of your script, and change the variable type from GUIText to Text. As in the following script.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class PlayerController : MonoBehaviour {
public float speed;
public Text countText;
private int count;
void Start ()
{
count = 0;
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
rigidbody.AddForce(movement * speed * Time.deltaTime);
}
void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "PickUp")
{
other.gameObject.SetActive(false);
count = count + 1;
SetCountText();
}
}
void SetCountText ()
{
countText.text = "Count: " + count.ToString();
}
}
Maybe at some point we can convince someone to redo the video.