|Topic was automatically imported from the old Question2Answer platform.
Today i run my test game and i noticed that my game were running slow when i had like 100 kinematic bodies on it
In the game those kinematic bodies autospawn just to destroyed when they hit a wall however i have got a script on those kinematic bodies and maybe the script is loaded one for each body so i think i have like 100 times my script loaded in the game…
my question is
- How to know if a script is loaded multiple times (most important)
- How to unload the destroyed nodes (mesh texture script) when i don’t need them or when they “die” in game
I need to know those 2 things, there is no reason to load multiple scripts since i can load 1 script on a base node + there is no reason for the destroyed nodes to fill game buffers.
How, exactly, do you load the kinematic bodies? Does the script call
load(), and then the bodies are instanced? Concerning destroying the instances: when they collide with something, have them call
queue_free() on themselves.
Ertain | 2020-03-14 17:51