Question by
CalmKai · Nov 07, 2015 at 02:31 AM ·
unity 5javascriptmouselookfirst-person-controllerrespawn
Assets/Scripts/RespawnMenu.js(8,20): BCE0018: The name 'MouseLook' does not denote a valid type ('not found'). Did you mean 'UnityStandardAssets.Characters.FirstPerson.MouseLook'? After Upgrading to Unity 5
Help! I get an error, Assets/Scripts/RespawnMenu.js(8,20): BCE0018: The name 'MouseLook' does not denote a valid type ('not found'). Did you mean 'UnityStandardAssets.Characters.FirstPerson.MouseLook'?
This is the RespawnMenu.js code: #pragma strict
var lookAround01 : MouseLook;
var lookAround02 : MouseLook;
var charController : CharacterController;
//var sprintScript : SprintAndCrouch;
static var playerIsDead = false;
function Start ()
{
lookAround01 = gameObject.GetComponent(MouseLook);
lookAround02 = GameObject.Find("MainCamera").GetComponent(MouseLook);
charController = gameObject.GetComponent(CharacterController);
//sprintScript = gameObject.GetComponent(SprintAndCrouch);
}
function Update ()
{
if (playerIsDead == true)
{
lookAround01.enabled = false;
lookAround02.enabled = false;
//sprintScript.enabled = false;
charController.enabled = false;
}
}
function OnGUI ()
{
if (playerIsDead == true)
{
if (GUI.Button(Rect(Screen.width*0.5-50, 200-20, 100, 40), "Respawn"))
{
RespawnPlayer();
}
if (GUI.Button(Rect(Screen.width*0.5-50, 240, 100, 40), "Menu"))
{
Debug.Log("Return to Menu");
}
}
}
function RespawnPlayer ()
{
Debug.Log("Respawn Player");
}
@script RequireComponent(CharacterController)
I know it is trying to access the MouseLook script that was removed in Unity 5, how would i fix this code to make it work with Unity 5.
Any help is appreciated!
Comment