playMaker

Author Topic: Activate/Deactivate game objects and garbage in profiler  (Read 10701 times)

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Activate/Deactivate game objects and garbage in profiler
« on: February 03, 2017, 05:48:23 AM »
Hi

I have read around the forum but cant find an answer, i have a Activate/Deactivate script on the parent of a platform which i just want to disable. Im testing using Unity remote on an android when i noticed a spike (attached screenshot) in the 'PlaymakerFSM.OnDisable'. Any ideas why this is?

The moving platform has a RigidBody with Kinematic enabled and all children just have OnTriggerEnter scripts on them. Any ideas?


also attached a onTriggerEnter screenshot


also i created a new scene and added just a box with child objects and i can get the same issue. Deep profile screenshot attached (3rd)


Nick

« Last Edit: February 05, 2017, 10:14:55 AM by coxy17 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Activate/Deactivate game objects and garbage in profiler
« Reply #1 on: February 06, 2017, 01:25:13 AM »
Hi,

 what you need to look for is what actually happens on these activated gameobject, typically, how do you move these objects?

 try to replace the platform with a dummy one that doesn't nothing and start fresh, if you still see the spikes, then it's simply that there is too much, regardless of your implement logic inside Playmaker.

Bye,

 Jean

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Activate/Deactivate game objects and garbage in profiler
« Reply #2 on: February 06, 2017, 03:54:32 AM »
Hi Jean

I'll give that a go and see what happens

All i had before was a scene with just one platform (nothing else other than a skybox) and attached a script OnTriggerEnter (5 FSM scripts). The platform has a rigid body as ive read that i need to do this on objects which dont stay static (for mobile performance). The object doesn't move as its used as a vanishing platform which appears every 3 seconds and then disappears for 3 seconds. in a constant loop.

In the screenshot from the first post it shows the profiler for the above scene, so i don't know why deactivating a game object with a FSM script using only a  OnTriggerEnter creates garbage?

The object which is vanishing using disable/enable is just a imported very low poly mesh, its small enough to be dynamically batched.

Also i have tried a different test, i decided to not activate/deactivate the game object and instead use 'DisableFSM' to see what happens when the scripts are disabled on there own and keep the object untouched, the disabled FSM's still create a 0.7KB of garbage (per script) is this normal? just for disabling a FSM on one game object?

Nick
« Last Edit: February 06, 2017, 07:32:33 AM by coxy17 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Activate/Deactivate game objects and garbage in profiler
« Reply #3 on: February 06, 2017, 08:35:08 AM »
 Hi,

 uhm, ok, what dataversion do you have in the Fsm inspector in the PlayMaker Editor, if your project is old, maybe the fsm is carrying over data from previous data structure of PlayMaker, I recall something like that.

 

Bye,

 Jean

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Activate/Deactivate game objects and garbage in profiler
« Reply #4 on: February 06, 2017, 08:50:28 AM »
Hi

Ok yes my project is 2 years old and im just developing it further so i will take a look when i get home after work. If it is the case then what can i do?

Nick

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Activate/Deactivate game objects and garbage in profiler
« Reply #5 on: February 06, 2017, 02:55:16 PM »
Hi Jean

I've checked and i have Data Version 2.

also tested in a new scene now with a cube and a fsm with deactivate and i get 0.7kb garbage.



Nick
« Last Edit: February 06, 2017, 03:45:59 PM by coxy17 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Activate/Deactivate game objects and garbage in profiler
« Reply #6 on: February 08, 2017, 02:46:37 PM »
Hi,

 I would copy the whole fsm and paste it into a new one, remove the old one and see if the garbage collection is still here.

 Bye,

 Jean

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Activate/Deactivate game objects and garbage in profiler
« Reply #7 on: February 08, 2017, 03:32:50 PM »
Hi Jean

I did this. I setup a new project and imported playmaker and setup a cube and added a new fsm. Still the same

When I do this it still says data version 2 on the fsm. Should it be this?

Nick
« Last Edit: February 08, 2017, 04:27:12 PM by coxy17 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Activate/Deactivate game objects and garbage in profiler
« Reply #8 on: February 09, 2017, 02:13:55 AM »
HI,

 ok, dataversion 2 is good, it if you had dataversion 1 that it would have been problematic.

 I'll raise a case internally, to check if something can be done on this.

Bye,

 Jean

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Activate/Deactivate game objects and garbage in profiler
« Reply #9 on: February 09, 2017, 08:04:22 AM »
Thanks Jean. 

I thought I was doing something wrong for ages now haha. 

I hope there is a resolution otherwise it's going to be a big performance issue for my game with alot of enable and disable fsms.

Thanks

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Activate/Deactivate game objects and garbage in profiler
« Reply #10 on: February 10, 2017, 12:57:09 AM »
Hi,

Ok, since you are still in editor, this is actually coming from the PlayMaker editor logging system, so nothing to worry about when you'll deploy, this won't happen.

 Bye,

 Jean

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Activate/Deactivate game objects and garbage in profiler
« Reply #11 on: February 10, 2017, 03:23:46 AM »
Hi Jean

Ok yes that makes sense then as in the deep profiler it has FSM Logs in it. So even with the Unity Remote 5 it shows so i guess ill have to log this as ok. anyway is there a way i can check this out of the Unity Editor at all?

Also was this the same issue for when i deactivated the game object? i guess so as all that was attached to the game object was the FSM's.

Thanks Jean for looking into this!
« Last Edit: February 10, 2017, 03:30:48 AM by coxy17 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Activate/Deactivate game objects and garbage in profiler
« Reply #12 on: February 10, 2017, 09:10:43 AM »
Hi,

 Not sure, the best way is to have android tools and watch memory consumption as you play your game.

 Bye,

 Jean

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Activate/Deactivate game objects and garbage in profiler
« Reply #13 on: February 11, 2017, 07:36:29 AM »
ok thanks anyway

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: Activate/Deactivate game objects and garbage in profiler
« Reply #14 on: February 12, 2017, 06:21:14 PM »
Hi Jean

I am struggling now as im testing in the profiler and it seems that playmaker is logging alot more than i though in the Editor. so its becoming hard to tell if my game is garbage free or not. Is there a way these notifications in the profiler can be turned off for remote profiling?

Nick