- Home /
Enable/Disable a Static object
in my project has an object (a laser) that is part of the scenario, it has a base of each side and the laser in the center, I can mark all the laser, the foundations and himself as static and runtime enable / disable the object?
Comment
Best Answer
Answer by tomhughes · Mar 31, 2015 at 10:57 AM
c#
public GameObject laser;
void Update (){
if(Input.GetKey(KeyCode.Y)) { laser.SetActive(false); } if(Input.GetKey(KeyCode.U)) { laser.SetActive(false); }
}
//////////////////////////////// with that (once you've clicked and dragged the object on to the script) it should work when pressing y or u.
if so you can then change the "if(....)" to whatever you need (timers/triggers etc)
i hope that helps