- Home /
Enable/Disable GameObject Button script
I'm a beginner in Unity 3D and i need help with creating a script. Here's how it should work. When i click the button 'Flashlight', the GameObject 'Flashlight Real' should be enabled. If the GameObject is already enabled, it should do the opposite. So how do i create this script?
Answer by burnumd · May 11, 2010 at 05:19 PM
See this similar Question/Answer.
I added the code but i get an error message -
Assets/Standard Assets/Scripts/Flashlight Button.js(1,6): UCE0001: ';' expected. Insert a semicolon at the end.
There is a semi-colon at the end
Light myLight = lightPoint.GetComponent("Flashlight Real");
Also, you need to put the if expression inside Update (or similar).
Your answer
Follow this Question
Related Questions
Disable SCRIPT HELP!!!! 1 Answer
How do I disable a wind zone through script? 2 Answers
Turn Off/on culling mask by script? 2 Answers