If you put a bunch of events into a extension function will the game run better?

so if every frame you go trough the events page if i put like a one time thing into a extension would that make the game run faster?
I have a loading system that loads things into the game from a json file and I’m asking if we make it run once from an extension function will it run better than having it inside the scenes event page.

1 Like

I’m not sure what your thought process is, but no, putting something in an extension won’t make it magically faster.

I was curious about the same thing. Some languages compile code in libraries differently.

There are no silly questions. Keep asking.

I was asking if putting it in the extension would let it run only one time instead of everyframe

I have not said the question is silly, I answered it.

I understood what you were saying, what I do not get is why you seem to think that events that are run only once would run every frame, and that extensions could fix it.

@BTM I suspect you’re asking if putting a bunch of code into an extension and calling that extension once will help performance by meaning it doesn’t have to get evaluated frequently in the event sheet…

I can see your reasoning behind this. But the only thing that affects whether events are actioned or not are the conditions you use.

So, for example, if you put 100 actions into an extension, then call that extension in your event sheet with the condition that it only runs once at the beginning of the scene, the extension and those 100 actions will only be run once as expected. But, that’s no different than adding those same 100 actions to the event sheet directly as sub-events of an “At the beginning of the scene” condition. They’ll still only be evaluated once because of the condition. As soon as that condition is no longer true, they’re ignored from then on.

The only real benefit to putting them into an extension in this case is readability and cleaning up your event sheet.

4 Likes