if Im doinig
GameObject.Find(“swat”).GetComponent().enabled = false;
so in the next I cant enable it like that
GameObject.Find(“swat”).GetComponent().enabled = true;
so what can I do to disable only a void like performMovment() or any other void.
please help. (sorry for bad English)
hello, you cant disable a “void”. void is returned type (which means they dont return a type) the enabled property stops the update calls, if you dont want to call one specific method just dont call it, and if you calling it in the update create a bool for controlling when you call it.
You don’t disable a method, you just don’t call it, say I have a method → Void A(){Debug.Log(“Hi”);} → and I call it in update → void Update(){A();} → but I want the console to stop printing out Hi 30 seconds after the games, I can simply add a if statment → if(Time.time < 30){A();} → There is also a lot of ways to do this, an if statment is the simplest like you can use a Coroutine or InvokeRepeating to repeat a method not every frame but a set amout of second that you want it to be, or you can use the switch statment to check on a value, and more and more…