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: 233
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Number of models

Post by Ats » Mon Jan 28, 2019 9:58 am

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

User avatar
VilleK
Site Admin
Posts: 1989
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Re: Number of models

Post by VilleK » Mon Jan 28, 2019 2:45 pm

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: 361
Joined: Sat Feb 15, 2014 9:54 am

Re: Number of models

Post by rrTea » Tue Jan 29, 2019 11:32 am

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: 233
Joined: Fri Sep 28, 2012 10:05 am
Contact:

Re: Number of models

Post by Ats » Tue Jan 29, 2019 8:24 pm

Hahaha so simple... :lol:
And I'm already counting enemies like that :oops:

User avatar
rrTea
Posts: 361
Joined: Sat Feb 15, 2014 9:54 am

Re: Number of models

Post by rrTea » Fri Feb 01, 2019 1:14 am

Sorry for stating the obvious :oops:

Post Reply