How do I fix my UnityEngine Reference?
One day I go into unity and boom 50% of my code is now red and so Is 'using UnityEngine and using UnityEngine.UI' (not the using part) I have done every fix currently known to man...
Reinstalled everything, Deleted the references folder (google said unity would replace it with the fixed UnityEngine.dll... it didn't (I replaced it myself)), I installed the latest .NET thingy. MonoDevelop just reverts back to 3.5 when it is restarted anyway, I started a new project (was worse on a new project couldn't run the basic game cause it had unexpected errors for = everywhere. I can still edit my ongoing projects current scripts but cannot start new ones for more UI for example. (actually the ball game from unity tutorials that I am adding on to) but cannot do anything on new ones.
I have truly tried everything.
Any Help Appreciated!!!
Answer by Danibro · Aug 08, 2017 at 01:01 AM
same error different line its for the OnTriggerEnter line... and about 10 errors about context...
using UnityEngine; using UnityEngine.UI; using System.Collections;
public class PlayerController : MonoBehaviour {
public float speed;
public Text countText;
public Text winText;
private Rigidbody rb;
private int count;
void Start ()
{
rb = GetComponent<Rigidbody>();
count = 0;
SetCountText ();
winText.text = "";
}
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 ();
if (count >= 24)
{
winText.text = "You Win!";
}
}
}