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:
i've read in both unity agk forums using if-else / switch conditions should minimal possible in update() function updates each frame.
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
Post a Comment