This is the error:
Assets/Scripts/Playercontroller.cs(38,27): error CS1061: Type UnityEngine.UI.Text' does not contain a definition for
Text’ and no extension method Text' of type
UnityEngine.UI.Text’ could be found (are you missing a using directive or an assembly reference?)
This is my code:
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class Playercontroller : MonoBehaviour {
public Text countText;
public float speed;
private int count;
private Rigidbody rb;
void Start ()
{
rb = GetComponent<Rigidbody> ();
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("Pickup"))
{
other.gameObject.SetActive(false);
count = count + 1;
SetCountText ();
}
}
void SetCountText()
{
countText.Text = "Count: " + count.ToString ();
}
}