playMaker

Author Topic: Activating / Deactivating Game objects causing weird profiler spikes  (Read 2291 times)

hunz

  • Playmaker Newbie
  • *
  • Posts: 35
Hey,

I've never really thought to ask but I'm noticing that activating objects is causing weird spikes here and there enough on mobile devices that a frame skips.

Is it better to not do this?  Have it always active and send an event to it instead? 

Thanks for any advice.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 activating/deactivating object is not the issue here, it's what the object does when you activate it, it's likely doing some performance sensitive actions such as "find Object" or something.

 Typically, it's creating and destroying GameObjects and Components that is causing spikes, and so I would look into what the fsms on this gameobject you activate does exactly.

 Bye,

 Jean

hunz

  • Playmaker Newbie
  • *
  • Posts: 35
Thanks for that Jean I'll have a look through it all and double check what is going on.

I use a pool manager for everything and set up any objects/game objects I need to access in global variables.

I will follow the chain and report back on what's causing it.  It's hard in the deep profiler to figure it out as the call it's reporting is different to the logic in the fsm. 
I'm guessing it's reporting it more in it's code form but I'll do my best to bridge those gaps.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 if you know which prefab is causing this, study first what the fsm do on Start, and the implications, if they send global events that in turn could do a lot of work as well. This is something you can do before profiling, and could well be enough for you to spot what's wrong.

 Bye,

 Jean