- Home /
This question was
closed Dec 12, 2018 at 07:23 PM by
jellygamingplayz for the following reason:
My script wasnt enabled lol
Question by
jellygamingplayz · Dec 12, 2018 at 07:17 PM ·
c#canvasplayer movement
[C#] When canvas is enabled stop player movement?
I've been trying to write my own script to do this but it won't work. I cant find any tutorials anywhere on how to do this. My plan is to have a trigger that enables a canvas and when that canvas is enabled i want to stop my player from moving. I am using the standard assets FirstPersonCharacter prefab.
Here is my script
public FirstPersonController firstPersonController;
public Canvas canvas;
public MouseLook mouseLook;
public PlayerMovement movement;
public void Update()
{
if(canvas.enabled == true)
{
firstPersonController.enabled = false;
mouseLook.enabled = false;
movement.enabled = false;
}
}
Comment
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
[C#] When canvas is enabled stop player movement? 1 Answer
Distribute terrain in zones 3 Answers
turn off interactable without changing alpha 0 Answers
Will someone please help me??? 2 Answers