Page 1 of 1

[solved] Number of models

Posted: Mon Jan 28, 2019 9:58 am
by Ats
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

Re: Number of models

Posted: Mon Jan 28, 2019 2:45 pm
by VilleK
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?

Re: Number of models

Posted: Tue Jan 29, 2019 11:32 am
by rrTea
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).

Re: Number of models

Posted: Tue Jan 29, 2019 8:24 pm
by Ats
Hahaha so simple... :lol:
And I'm already counting enemies like that :oops:

Re: Number of models

Posted: Fri Feb 01, 2019 1:14 am
by rrTea
Sorry for stating the obvious :oops: