- Home /
Simple start mechanism
Hey, so i am trying to do instant gameplay when i clicked start button(my panel is start button) every game mechanism should start(same scene as start menu). But i am concerned about my method if its okay for performance or sensible etc because its gonna check everytime for panel.
And this is my script for stopping all game mechanism;
void Update()
{
if (Panel.gameObject.activeSelf==false)
{
//starting game
}
Hi!
In terms of "will I notice it" - no, you will not, because meanwhile it's checking each frame we have games where a lot of things going on each frame, so it's not hard for engine to do that at all.
However, in terms "can it be done better" - yes, it can, because there is actually no reason for checking each frame if panel is active or not, because you have a function that makes it inactive, right? So why not enable everything there, so it will be called only once.
Answer by FZ_Applications · May 25, 2020 at 06:09 PM
One Update loop won't kill your performance. But if you really want to make it more performant, use OnDisable() / OnEnable() methodes in a script placed on the Panel gameObject.
Your answer
Follow this Question
Related Questions
Initialising List array for use in a custom Editor 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
how can i learn unity? 0 Answers
How do i start a game with Unity, what do i need first? 0 Answers