Hey guys. I’ve been working on a script that makes it so that when the player presses the space bar, it disables/enables the simple mouse rotator component attached to the player and the main camera “using the standard assets beta character prefab” However, I’m getting these errors:
Modified Cursor.js(6,62): BCE0005: Unknown identifier: ‘SimpleMouseRotator’.
and
Modified Cursor.js(7,54): BCE0005: Unknown identifier: ‘SimpleMouseRotator’.
Can someone tell me what I did wrong?
The Script:
var changeToggle : boolean;
var script : SimpleMouseRotator;
var script2 : SimpleMouseRotator;
function Start() {
script = GameObject.Find("Main Camera").GetComponent(SimpleMouseRotator);
script2 = GameObject.Find("Player").GetComponent(SimpleMouseRotator);
}
function Update (){
if (Input.GetKeyDown("space")){
if(changeToggle)
Screen.lockCursor = true;
script.enabled = true;
script2.enabled = true;
}
else
{
script.enabled = false;
script2.enabled = false;
Screen.lockCursor = false;
changeToggle = !changeToggle;
}
}