[solved] Number of models

If there is something important you think is missing in the current version of ZGameEditor then you can post a feature request here!

Moderator: Moderators

Post Reply
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

[solved] Number of models

Post 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
Last edited by Ats on Tue Jul 26, 2022 8:55 am, edited 1 time in total.
User avatar
VilleK
Site Admin
Posts: 2274
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Number of models

Post 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?
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Re: Number of models

Post 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).
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Number of models

Post by Ats »

Hahaha so simple... :lol:
And I'm already counting enemies like that :oops:
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Re: Number of models

Post by rrTea »

Sorry for stating the obvious :oops:
Post Reply