- Home /
game object hide
hey im sorry this is maybe alreddy on the site but can`t find it please tell me what i did wrong this is a script for my fire light wehen i fire my gun gets a flikkering light animation that works but i want also when i stop firing that the game object licht call it ("new gun fire light"); disapears but wont work please help
The script
function Update()
{
if( Input.GetButton( "Fire1" ) ) { animation.Play("new gun fire light"); } if( Input.GetButtonUp( "Fire1" ) ) { animation.Stop("new gun fire light"); } } else { if( Input.GetButtonUp( "Fire1" ) ) ("new gun fire light");.enabled = false; } }
thank you
Wesley please when you post scripts please mark your code and press the "10101" button. It will make the code nice and easy lined up and easier for us to read. Please remember this the next time. :)
Answer by efge · Jan 05, 2011 at 02:23 PM
"Enabled" is not available for GameObjects.
You should use this:
gameObject.active = false;
Your answer
Follow this Question
Related Questions
hide game object problems 2 Answers
throw / fling object or prefab 1 Answer
Respawning script question. 1 Answer
Help With LookAt Target 1 Answer
How can I make a Transform that I dont have to set each time I place a prefab? 1 Answer