using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Scriptsphere : MonoBehaviour{
private Rigidbody rb;
private int count;
public Text countText;
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);
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag ("pickup")) {
other.gameObject.SetActive (false);
count = count + 1;
setCountText ();
}
}
void setCountText()
{
countText.text "Count: " + count.ToString ();
}
}
So what is wrong with this code?
countText.text "Count: " + count.ToString ();