Im trying to access a c# variable with java. Code is here:
#pragma strict
private var otherScript : PlayerPoints;
function Awake(){
otherScript = this.GetComponent("PlayerPoints");
}
It gives me:
The name 'PlayerPoints' does not denote a valid type ('not found'). Did you mean 'UnityEngine.Light'?
Whats wrong?
To keep things simple, you can just make otherScript’s Type out to be Object or Component. To be sure it’s working, use GetType() and print out to the console.
#pragma strict
private var otherScript : Component;
function Start()
{
otherScript = GetComponent("PlayerPoints");
if(otherScript)
print(otherScript.GetType() + " Found!");
else
print("Script not found.");
}