I am using outdated unity 4 scripts on unity 5 and am trying to launch my game but i get multiple compiler errors stating that…
“The name ‘MouseLook’ does not denote a valid type (‘not found’). Did you mean ‘UnityStandardAssets.Characters.FirstPerson.MouseLook’?”
I have looked online and some say that i should have a script titled mouselook for it to work but i already do. anyone have any idea how to fix this?
Need code.
sure, this is one of 3 scripts causing compiler errors
#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)
And this is my code titled MouseLook
#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)
Change all of the GetComponent calls so that they use one of the following (I personally recommend the top one, as it doesn’t require casting afterward):
GetComponent<ScriptName>();
GetComponent("ScriptName");
GetComponent(typeof(ScriptName));
Anywhere you have MouseLook change it to UnityStandardAssets.Characters.FirstPerson.MouseLook in all of your scripts.
@DonLoquacious - They’re using JS not C#.
Sometimes if you update the script, even just a comment, then save it unity will fix the issues caused by the new version. It’s a lazy way tho
I dont rlly know what im doing, can any of you give me any detailed instructions?
This is about as detailed as you need, it says what to do