- Home /
[c#] first script isnt disabling canvas and player cant move (issue with first script)
Hi, I have made a script that enables a canvas if a certain gameobject isnt active in the hierarchy
here is the first script
public void Update()
{
if (trigger.activeInHierarchy == false)
{
canvasToShow.enabled = true;
}
else if(trigger.activeInHierarchy == true)
{
canvasToShow.enabled = false;
}
}
the second script is a script that disables player movement when the canvas is enabled.
public void Start() { if(canvas.enabled == true) { controller.enabled = false; Cursor.lockState = CursorLockMode.None; Cursor.visible = true; }
else if(canvas.enabled == false)
{
controller.enabled = true;
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
}
my problem is that when i start the game i cant move because for some reason the first script isnt disabling the canvas.
Your answer
Follow this Question
Related Questions
[c#] first script isnt disabling canvas and player cant move (issue with first script) 1 Answer
Can CanvasRenderer provide third UV coordinates? 0 Answers
Set GameObject for OnClick.AddListener Lambda 0 Answers
Canvas Button OnClick() function arguments 1 Answer
Scene Is Missing A Full Screen Camera? 2 Answers