- Home /
How to disable script in other object
Hi, i want disable script in other object - i have interaction and when interacion will start i will disable movement... but i used this scripts but i have errors i used unity API documentation and i really dont know where can be problem, i have movement script as component in player object
GameObject.Find("player").GetComponent(movement).enabled = false;
movement is javascript - movement.js and object is player ,I have those three errors
error CS1502: The best overloaded method match for UnityEngine.GameObject.GetComponent(System.Type)' has some invalid arguments error CS1503: Argument
#1' cannot convert object' expression to type
System.Type' error CS0103: The name `Movement' does not exist in the current context
Answer by DeveshPandey · Sep 26, 2014 at 11:01 AM
Try this, by passing script name as string instead of Type.
GameObject.Find("player").GetComponent("movement").enabled = false;
I solved it with time.timeScale .... i wanted only pause movement when im in GUI, then i dont pausing script now but game
Your answer
Follow this Question
Related Questions
How can I access values from a component script in another object 1 Answer
Multiple Cars not working 1 Answer
Problems with Audio Sources 1 Answer
Distribute terrain in zones 3 Answers
how to get in game numerical input 1 Answer