Hi. Is it possible to add something such as App.Models or App.ModelCounter in order to retrieve the number of active models, same as "Models:" in the debug log?
BTW, in that very log, what are "Managed" and "t" stands for?
Thanks
[solved] Number of models
Moderator: Moderators
[solved] Number of models
Last edited by Ats on Tue Jul 26, 2022 8:55 am, edited 1 time in total.
Re: Number of models
The "managed" stuff is related to the automatic garbage collection of strings and arrays. If those values rise drastically then there might be a bug, but I've rarely had any use for that information.
To get a total count of models from script I guess you can loop the categories you use and call getModels and sum the size of the arrays?
To get a total count of models from script I guess you can loop the categories you use and call getModels and sum the size of the arrays?
Re: Number of models
I just have a counter for each type of model that I want to track (for example "onscreen_Enemy;") and in the base model of the models that have to be tracked a simple
OnSpawn: onscreen_Enemy++;
OnRemove: onscreen_Enemy--;
instead of getModels (although that works nicely too!).
This will work even if you change the Category of the Model for some reason + it has other minor advantages, especially in situations where lots of models are spawned / deleted each frame.
For simple things I just use getModels too (for example when spawning a cursor get all the buttons it can go to etc).
OnSpawn: onscreen_Enemy++;
OnRemove: onscreen_Enemy--;
instead of getModels (although that works nicely too!).
This will work even if you change the Category of the Model for some reason + it has other minor advantages, especially in situations where lots of models are spawned / deleted each frame.
For simple things I just use getModels too (for example when spawning a cursor get all the buttons it can go to etc).
Re: Number of models
Sorry for stating the obvious