Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Gua on March 25, 2019, 05:37:45 AM

Title: Editor performance on gameobject with lots of fsms
Post by: Gua on March 25, 2019, 05:37:45 AM
I often work with gameobjects that have a lot of fsms on them. That means when that kind of game object is selected, performance in editor is very poor (5-10 fps).

If I collapse thosefsms like this. Performance gets back to normal.
(https://i.gyazo.com/be71707664dc1d97a47c390281da5a80.png)

But for my workflow I need fsm name and edit button. And collapsing those partially doesn't completely solve the issue
(https://i.gyazo.com/1e2e609dc6801a2d011b200e3b011654.png)

I guess it's because all those refresh buttons and extra stuff still needs to be rendered. By the way, I don't even know what those Refresh buttons supposed to do.

So is there a way to enable some simplified rendering for those fsm components in inspector or some sort of workaround for the issue?
Title: Re: Editor performance on gameobject with lots of fsms
Post by: djaydino on March 26, 2019, 02:08:24 AM
Hi.
A while ago jean and i where actually talking about the exposed variables.

It was not so for performance but i think this will help in performance actually.

The idea was to have the exposed variables in a separate window and sorted by fsm/catergoy/name.

And being able to see and set variables from there.
But it might also be usefull during gameplay and have less performance issues.

I will, contact jean and have a look if we can build something like this.
Title: Re: Editor performance on gameobject with lots of fsms
Post by: jeanfabre on March 26, 2019, 02:47:49 AM
Hi,

 can you share this project so we can look at it? 5-10fps is very low, something is odd here. Have you ran the editor profiler to see what's going on?

- what version of Unity are you using?
- what version of PlayMaker are you using?

 Bye,

 Jean
Title: Re: Editor performance on gameobject with lots of fsms
Post by: djaydino on March 26, 2019, 09:42:22 AM
Hi.
I got also a very low fps if inspector is in sight and fsms are not collapsed.
on one of the projects i am working on, But i have 19 fsms on the object :)

U : 2018.2.10f1 PM : 1.9.0.p12

if you wish i can ask if i can share to you.
Title: Re: Editor performance on gameobject with lots of fsms
Post by: jeanfabre on March 28, 2019, 02:33:12 AM
Hi,

 sure, send it to Alex directly :) he'll have a better understand of what's going on and where things can be improved at that level.

 Bye,

 Jean
Title: Re: Editor performance on gameobject with lots of fsms
Post by: Gua on May 05, 2019, 12:54:14 PM
Hi,

 can you share this project so we can look at it? 5-10fps is very low, something is odd here. Have you ran the editor profiler to see what's going on?

- what version of Unity are you using?
- what version of PlayMaker are you using?

 Bye,

 Jean
Sorry for late response.
Unity 2018.3f2. Playmaker 1.9.0p5. It's actually easy to reproduce in fresh project. Just add 30 fsms to any object and have inspector opened. In empty project it will be better than 5 fps, but performance decrease will be noticeable.

I did send you real/test project. (Check your PM).

Here's what profile shows in my real project. As expected it's InspectorWindow.DrawEditors


p.s. Maybe there's a component that is responsible to what is being shown in inspector and I can private most of the stuff there to prevent it from showing it? Cause I usually only need Name. Edit button. Template field and reset on disable.

Performance was noticeable better in Unity 5.6. So I suspect that Refresh button (I mean drawing it 30 times) is what consuming a chunk of performance. By the way. Can someone explain to me what refresh button does?

Here's same object in Unity 5.6
Title: Re: Editor performance on gameobject with lots of fsms
Post by: Gua on June 08, 2019, 03:02:29 AM
(https://i.gyazo.com/9539665cdcd3662e41e8f48a98648565.png)
Title: Re: Editor performance on gameobject with lots of fsms
Post by: jeanfabre on June 13, 2019, 04:46:17 AM
:)

Let me ping Alex to check if he's on your case.

Bye,

 Jean



Title: Re: Editor performance on gameobject with lots of fsms
Post by: Gua on June 25, 2019, 03:19:11 AM
Since you've stopped responding to PM messages. I got worried. Please confirm that you received my last message regarding links to the project. Also, if you send me e-mail address for communication. It will be great, cause forum PMs seems unreliable. 
Title: Re: Editor performance on gameobject with lots of fsms
Post by: miguelfanclub on June 25, 2019, 03:07:57 PM
Better you guys continue here, so we all can see whats going on.
Title: Re: Editor performance on gameobject with lots of fsms
Post by: Gua on June 26, 2019, 10:48:17 PM
Better you guys continue here, so we all can see whats going on.
I need to send him links to my project. So at least that part should be private. Actually I did send him links, multiple times, but he replayed that he doesn't see those links in the private message, that's why I want to switch to e-mail. Cause PM system in this forum seems bugged.
Title: Re: Editor performance on gameobject with lots of fsms
Post by: djaydino on June 27, 2019, 12:41:56 AM
Hi.
If the link is a url, it should show up.

what kind of link are you sending?
Title: Re: Editor performance on gameobject with lots of fsms
Post by: Gua on June 27, 2019, 05:20:56 AM
Hi.
If the link is a url, it should show up.

what kind of link are you sending?
(https://i.gyazo.com/f13f6f684296979231ae7fa1562537c2.png)
Title: Re: Editor performance on gameobject with lots of fsms
Post by: allender on June 27, 2019, 07:33:31 AM
One thing that I've noticed about performance in editor is that the playmaker window itself can cause slowdowns.  I've seen super slow performance while play in editor with the playmaker window open.  As soon as I scrub the visible portion of the state machine using the rect view in the upper right corner of the PM window, performance seems to return to normal.
Title: Re: Editor performance on gameobject with lots of fsms
Post by: djaydino on June 27, 2019, 07:47:38 AM
Hi.
Strange indeed that they are not show at Jean's end.

I have also lag issues similar to yours on a character with 20+ fsms.

I am actually thinking to make a tool so i can drop in fsms that exposes variables in the inspector.
And it will display all the variables in a separate window. (with fsmnames and category to group them)

That way the fsms can stay collapsed and i think it will improve the performance
and also workflow.

But at the moment i have a overload of work for the summer, so i can't say when i can create this.
Title: Re: Editor performance on gameobject with lots of fsms
Post by: miguelfanclub on June 28, 2019, 04:04:53 AM
Not related to the inspector issue but in my project, not showing scene view as well as not showing playmaker editor window, makes the game to be +15 fps in game while playing.
Title: Re: Editor performance on gameobject with lots of fsms
Post by: djaydino on June 28, 2019, 04:24:27 AM
Hi.
Yes any active window can potentially slow down the fps.

for best Performance testing you should make a build of your game.
Title: Re: Editor performance on gameobject with lots of fsms
Post by: Gua on June 30, 2019, 02:43:33 AM
For me it is cleary inspector stuff. You can see it in profiler and as soon as I deselect gameobject with those fsms, my editor performance returns to the way it should be. And it's the work around that I currently use to be able to work with those fsms. I even have a script with a bind to mouse button to quickly deselect gameobject. But this workflow creates a extra clicks and inconveniences, that's why I would prefer to find a fix for this issue. But I'm repeating myself.

It's a shame that it's so hard to get support for Playmaker. Aside from this topic I've send PMs and e-mails regarding this issue, but got no response. And as soon as this topic finally got a response, everything immediately stopped and now we're back on the halt. I've created this topic 3 months ago, but there was absolutely not progress toward solution for the issue. :(

Title: Re: Editor performance on gameobject with lots of fsms
Post by: miguelfanclub on June 30, 2019, 05:47:51 AM
Maybe a playmaker downside and nothing to do.
I never work with more than one (max 2) FSM in the same game object.
Its SUPER tedious.
Title: Re: Editor performance on gameobject with lots of fsms
Post by: djaydino on June 30, 2019, 09:05:03 AM
Hi.
I can assure you that they are trying to find a solution.

This issue has been there for a long time, but it did get worst with the latest unity version.

Main issue is unity's design to get things working in the inspector.
Each open component is updated continuously .

For example when you expand a collider in the inspector it will be seen in the scene view and updated.
When you collapse it the collider is not shown in the scene view.

Playmaker holds a lot of data in the backend (not visible) to show every state/action/transitions/colors/names/positioning everything/etc which gets updated all the time when not collapsed.

That is the main Reason fsm with lots of states also tend to slow down.

also, if you have a fsm with many states it will show a note
(https://i.imgur.com/QCToCVl.png)

I actually use many fsms as well on a single object (like player or enemies)

when i need to edit or test some variables from within the inspector and have many fsms, i tend to collapse all.
Then play and expand the one that i want to test values from.

if unity's inspector would be able to expand/collaps component of the same types individually , it could solve already a lot of lag.
Title: Re: Editor performance on gameobject with lots of fsms
Post by: Gua on June 30, 2019, 09:24:13 AM
Hi.
I can assure you that they are trying to find a solution.

This issue has been there for a long time, but it did get worst with the latest unity version.

Main issue is unity's design to get things working in the inspector.
Each open component is updated continuously .

For example when you expand a collider in the inspector it will be seen in the scene view and updated.
When you collapse it the collider is not shown in the scene view.

Playmaker holds a lot of data in the backend (not visible) to show every state/action/transitions/colors/names/positioning everything/etc which gets updated all the time when not collapsed.

That is the main Reason fsm with lots of states also tend to slow down.

also, if you have a fsm with many states it will show a note
(https://i.imgur.com/QCToCVl.png)

I actually use many fsms as well on a single object (like player or enemies)

when i need to edit or test some variables from within the inspector and have many fsms, i tend to collapse all.
Then play and expand the one that i want to test values from.

if unity's inspector would be able to expand/collapse component of the same types individually , it could solve already a lot of lag.
Here it is clearly visible that drawinspector is what takes away performance
So I assumed that drawing all those buttons and other fields related to Playmaker script in inspector is what takes away performance. So if drawing that script was not backed into *.dll I would just open that script and used a lot of [HideInInspector] to hide fields that I usually don't need, to improve performance. But from my understanding I can't do/test this, cause it's backed into *.dll correct?
Title: Re: Editor performance on gameobject with lots of fsms
Post by: djaydino on June 30, 2019, 10:36:12 AM
Hi.
I think you misunderstand what i mean.

it's not about what you see in the inspector.
its about what it does when not collapsed to the scene.

When you look to the collider example :
When expanded, it draws the collider in the scene when selected and it is called continuously .

Now for the playmaker component when expanded it will do the same,
But playmaker holds a lot more data.

Each state/state position/state color/action/transition/colors and so on are stored on the component.
Even the basic fsm with no actions yet inside has already a bunch of data to make things work.

And this is called every time for each playmaker component.

Playmaker actually does not need to be refreshed every time in the scene, but that is a unity limitation and can not be disabled.

as well a for expanding a single component of the same type, wich would already improve the performance for PlayMaker
Title: Re: Editor performance on gameobject with lots of fsms
Post by: Gua on July 01, 2019, 01:36:55 AM
Hi.
I think you misunderstand what i mean.

it's not about what you see in the inspector.
its about what it does when not collapsed to the scene.

When you look to the collider example :
When expanded, it draws the collider in the scene when selected and it is called continuously .

Now for the playmaker component when expanded it will do the same,
But playmaker holds a lot more data.

Each state/state position/state color/action/transition/colors and so on are stored on the component.
Even the basic fsm with no actions yet inside has already a bunch of data to make things work.

And this is called every time for each playmaker component.

Playmaker actually does not need to be refreshed every time in the scene, but that is a unity limitation and can not be disabled.

as well a for expanding a single component of the same type, wich would already improve the performance for PlayMaker
I did understand it the first time and as far as I know, you might be 100% correct. But considering your explanation I find it weird that profiler shows resource consumption as DRAW inspector. That's why I would love to test your assumption by hiding most fields and buttons from inspector to see if there will be any noticeable performance difference. But if I understand it correctly, code that is responsible for Playmaker script interface in inspector is hidden in *.dll so I can't perform that test.
Title: Re: Editor performance on gameobject with lots of fsms
Post by: djaydino on July 01, 2019, 03:24:57 PM
Hi.
On your Profiler image you can see that it is actually the DrawEditors @2:02
and not draw inspector.

Hiding fields will not change anything.

But yes the core of Playmaker is inside the .dll file
Title: Re: Editor performance on gameobject with lots of fsms
Post by: Gua on July 03, 2019, 01:10:35 PM
I actually would be fine with collapsed Playmaker scripts. The problem is that I prefer to used Playmaker with Locked view. That means I need edit button of Playmaker script to be visible, to start editing script on selected gameobject and as soon as I select one fsm on gameobject, playmaker provides great tool for fast switching between fsms on gameobject that hosts fsm that I'm currently editing. So the issue is only in initial first step, when I can't start editing fsm unless I "uncollapse it" or uncheck Lock button and relesect game object and check lock again, which is not very convenient.

update: Although I've just found a problem with templates, where quick switch tool is useless when you have templates on your fsms on game object like here.

(https://i.gyazo.com/e249dac751348f138e26fa5ba3a771e5.png)
Title: Re: Editor performance on gameobject with lots of fsms
Post by: djaydino on July 03, 2019, 04:42:34 PM
Hi.
It might help to categorize the Templates, when you select a template you can give it a category, and even sub-categories when using slash.

(https://i.imgur.com/bF4HaKcl.png)

(https://i.imgur.com/0gWbrGAl.png)

You can also 'multi select' a bunch of templates and set a category then for all selected.

(https://i.imgur.com/dcAEsYQl.png)

I never knew it was there, i only noticed this like last week.

Btw if you have the templates in the standard folder, you should move then to another folder outside the PlayMaker folder.
It happend to me once that i deleted playmaker to reinstall and lost all templates.

These days its not possible anymore with me as i use github for all my (and my customers) projects, so i can always discard or revert changes.
Title: Re: Editor performance on gameobject with lots of fsms
Post by: Gua on July 17, 2019, 06:51:11 PM
@djaydino, will a more powerful CPU improve performance for this use case?
Title: Re: Editor performance on gameobject with lots of fsms
Post by: djaydino on July 18, 2019, 08:24:47 AM
Hi.
it depends on you current cpu if its really old, but i don't think it will speed up much.
Title: Re: Editor performance on gameobject with lots of fsms
Post by: Gua on September 19, 2019, 08:00:34 PM
Hi.
it depends on you current cpu if its really old, but i don't think it will speed up much.
I've just build new PC with Intel Core i9-9900K (previously I was using intel i7 3770k). As soon as I hooked up SSD with my project I've immidiatly intalled Unity to test inspector performance. And I'm happy to report that new hardware sagnificatly improved editor perfomance. Profiler shows 43% improvement. When I actively scrolled over game object with lots of FSM components I previously got 133 ms and now I get 93 ms. I can also add, that when I needed to edit any fsm on that object I had to deselect selected gameobject, because performance was just too poor even for a small edit. And now it's much more smooth, so seems that I can stop doing that :)