c# - Call once in Update() without boolean condition -


this question related unity3d c# appgamekit c++.

is advisable use boolean condition call function/statements once shown in example below?

unity3d c#

bool _call = false;  void update() {   if (!_call)     {       call = true;       // statements     } } 

agk c++

bool _call = false;  void app::loop(void) {   if (!_call)     {       _call = true;       // statements     } } 

i'm asking because of following reasons:

  1. i've read in both unity agk forums using if-else / switch conditions should minimal possible in update() function updates each frame.

  2. i'm curious if there other way possible have statements/functions called once while being called in update() function. if not, can make program go start() / begin() section of program while in middle of update() / loop() function have functions/statements called there, once.

1) having single boolean conditional each frame isn't going make of difference performance. said, it's practice keep logic minimum doing require reason in terms of design.

2) execution of script can restarted. check out link: onenable, awake, start order , link here: behaviour.enabled


Comments

Popular posts from this blog

node.js - Using Node without global install -

How to access a php class file from PHPFox framework into javascript code written in simple HTML file? -

java - Null response to php query in android, even though php works properly -