- Home /
disable a script
hey, i need to disable a script from a vehicle when the player gets off, the script is not done yet, anyway gameObject.GetComponent("TankMovementScript").enabled = false; doesent work, it tells me enabled is not member of get componenet. if there is a fix or an other way pleas tell me. thanks
p.s both scripts are in the same game object
Answer by Eric5h5 · Dec 21, 2012 at 05:57 PM
You should pretty much never use strings in GetComponent; that makes it return Component instead of the correct type.
Your answer
![](https://koobas.hobune.stream/wayback/20220613085752im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
If you disable a gameobject, does an InvokeRepeating loop end or pause? 3 Answers
How would I change the value of one prefab's variable via script without changing all of them? 1 Answer
gameobject.setActive(true) || (false) hiccups game for 3 to 5 seconds 4 Answers
How do you remove a script from an object? 4 Answers
Sending values to other gameobjects 1 Answer