playMaker

Author Topic: disabled FSMs causing terrible lag. why?  (Read 3958 times)

amaranth

  • Full Member
  • ***
  • Posts: 172
disabled FSMs causing terrible lag. why?
« on: August 10, 2012, 03:08:38 PM »
[UPDATED]

I have 100 inventory slots in a menu.
Each slot is a button with 2 disabled FSMs attached to it.
In total, I have 200 disabled FSMs in the game.
Even though the FSMs are disabled, it causes terrible lag in the game.

A few things I've noticed:
-If game object slot is disabled, lag still persists.
-If FSMs attached to game object are disabled, lag still persists.
-If I remove the FSMs, lag goes away.

So..... is there a way to "hide" a disabled FSM so that it isn't being processed by PlayMaker? Even in disabled status, the FSM appears to still be called by PlayMaker.
« Last Edit: August 10, 2012, 07:13:18 PM by amaranth »

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: performance, visibility, snappy menus > your thoughts
« Reply #1 on: August 10, 2012, 04:53:31 PM »
I have not done what you're trying to do, but if I were to try and help my first question would be: what are you using for your GUI?  Built in Unity GUI?  NGUI?

amaranth

  • Full Member
  • ***
  • Posts: 172
Re: performance, visibility, snappy menus > your thoughts
« Reply #2 on: August 10, 2012, 05:15:41 PM »
NGUI

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: performance, visibility, snappy menus > your thoughts
« Reply #3 on: August 10, 2012, 05:36:18 PM »
Have you tried the Set Camera Culling Mask action?  That, or disabling your GUI camera, but those also might not disable the GUI collision detection, which means you could potentially end up clicking on GUI widgets that are invisible to you. 

Let me know your results.

amaranth

  • Full Member
  • ***
  • Posts: 172
Re: performance, visibility, snappy menus > your thoughts
« Reply #4 on: August 10, 2012, 07:04:23 PM »
Yeah, already tried that. It cuts down draw calls which is great. I think I found the issue, and it's not what I originally thought it was.

Here's my new mystery:
  • Menu contains 100 buttons.
  • Each button contains 2 FSM scripts, for a total of 200 FSM scripts.
  • When menu and child buttons disabled, major LAG.
  • When FSM scripts attached to all buttons disabled, major LAG.
  • To make sure it wasn't NGUI, I created a pool, with 100 empty, disabled game objects & 200 disabled FSMs. I got major LAG.
  • I removed the FSMs, no lag.

So, it seems that even though an FSM is disabled, something somewhere is always calling it.
« Last Edit: August 10, 2012, 07:06:05 PM by amaranth »

amaranth

  • Full Member
  • ***
  • Posts: 172
Re: disabled FSMs causing terrible lag. why?
« Reply #5 on: August 11, 2012, 11:38:44 PM »
Update! I discovered the lag only occurs when the PlayMaker editor window is open. If I switch to another tab that hides the window, the problem goes away.

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: disabled FSMs causing terrible lag. why?
« Reply #6 on: August 11, 2012, 11:41:51 PM »
I definitely get horrible lag any time I am running the game with the FSM editor window open, or even just using the Unity with FSMs in the scene, and having the editor window open, sometimes performance gets super-crappy.

In your case however I had the impression that this was occuring in your builds as well.  No?

I'm glad it sounds like things are working out for you at least!

amaranth

  • Full Member
  • ***
  • Posts: 172
Re: disabled FSMs causing terrible lag. why?
« Reply #7 on: August 12, 2012, 12:29:35 AM »
I've only been recently testing in the game editor and was freaking out. I sent a bug report to Alex. If you've got the problem too, I would probably let him know. The more info he has, the easier it will be for him to track down the leak. (I think it must be a leak... or something crazy hogging memory!)