SceneMap Update - Add multiple conditional branches in the code.

Hello friends!
I'm making a plugin. And in that, I use the function below to check two things, like this:

Spoiler: SceneMap Update
Code:
var _Elimobpc_Scene_Map_updateScene = Scene_Map.prototype.updateScene;

Scene_Map.prototype.updateScene = function() {
        _Elimobpc_Scene_Map_updateScene.call(this);
         if (Utils.isMobileDevice()) {
         return $gameSwitches.setValue(Eli.Param.DevelopmentSwitch.mobile, true);
         }
         if ($gameSwitches.value(Eli.Param.DevelopmentSwitch.mobile) == false) {
         return $gameSwitches.setValue(Eli.Param.DevelopmentSwitch.desktop, true);
         } 
};

So I added more conditional branches for checking some conditions, if it were true then "return stuff".
However, the use of multiple "return" was not working to check all conditions, I think none maybe.

Then I discovered that
"The return statement stops the execution of a function and returns value from that function."

So I just took the "return" code and left only the commands to activate the switch, for example:

Code:
if (Utils.isMobileDevice()) {
$gameSwitches.setValue(Eli.Param.DevelopmentSwitch.mobile, true);
}

And it works! All the checks.
My question is:

Adding multiple conditional branches to the SceneMap Update function is something I should be worried about that might disrupt performance? Or cause incompatibility with other plugins?

Should I put some things in GamePlayerUpdate for example (in case I want to activate a switch when the player is in some vehicle or on a damage floor)?

Thanks!!
Well simply checking the value of a boolean isn't something too intense. It probably won't affect performance much. But do you really need to check that value every frame?
Well simply checking the value of a boolean isn't something too intense. It probably won't affect performance much. But do you really need to check that value every frame?
No, i don't. Lol, this qiestion of yours open my mind hauahauahaua
I will try to check this in another function or will try to make my own!
But at least i know that performance drop will not be a big deal ^^
Thanks!!
That single line wont probably cost much, but if you keep adding stuff like that, they will eventually.. So as mush said, think first if you really need to be doing them every frame

In your example, I doubt the value of that boolean will change while the game is running, so you could just do the check right at the start of Scene_Start for example.

Original thread: https://forums.rpgmakerweb.com/threads/scenemap-update-add-multiple-conditional-branches-in-the-code.107529/