Probably a very noob question, but I ve been struggling on it for hours now.
The problem I am having is when I apply a CSharp script, it keeps giving me this warning: – The associated script can not be loaded – Please fix any compile errors – and assign a valid script
The script is right because I got it from Unity tutorials, the java version work fine but the C# never does…
I tried different things such as running as Administrator (Windows 7) Or turning off my Antivirus… but nothing seem to help, any help would be really appreciated.
I am fairly new to Unity, but I m sure this shouldn’t be to hard to fix, but I cant seem to find an answer on Google, so I hope someone here will be able to help.
Thank you
–That s the script that I cant get to work in C#, but the Java version work fine.
using UnityEngine;
using System.Collections;
public class ExampleBehaviourScript : MonoBehaviour
{
void Update ()
{
if(Input.GetKeyDown(KeyCode.R))
{
gameObject.renderer.material.color = Color.red;
}
if(Input.GetKeyDown(KeyCode.G))
{
gameObject.renderer.material.color = Color.green;
}
if(Input.GetKeyDown(KeyCode.B))
{
gameObject.renderer.material.color = Color.blue;
}
}
}