playMaker

Author Topic: GetComponent/SetProperty Causes EDITOR Lag  (Read 2821 times)

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
GetComponent/SetProperty Causes EDITOR Lag
« on: September 20, 2019, 08:08:41 AM »
Area: Editor
Frequency: Always

1) What happened

As soon as I add any GET Component variable actions, performance slows to a crawl in that FSM. I fully tested and confirmed this, but I can report this somewhere else. The result, though, is that editing new state names, adding new states, etc. gets laggy in larger fsms, and having sub-graphs would help this. My brain goes SO FAST in empty fsms, and the fsms can keep up until I start adding GET FSM actions. Sometimes I make those states brown (poop) so I can go through and disable those actions while editing, then hopefully remember to re enable them before going into play mode. 

REPRODUCING:
The attached template shows this PERFECTLY. All you gotta do is enable or disable the GET FSM variable action, then type descriptions or create new states or label them, and there is lag for me.

I THINK it works with GET FSM VARIABLE as well, but not as extreme.

billsmithnine@gmail.com

Unity Info:
Unity Version: 2019.2.0f1
Playmaker Version: 1.9.0.p18
BuildTarget: StandaloneWindows

System Info:
OS: Windows 10  (10.0.0) 64bit
Processor: AMD FX(tm)-4130 Quad-Core Processor
System Memory: 32749
Graphics Device: NVIDIA GeForce GTX 970
« Last Edit: May 07, 2020, 06:13:23 PM by westingtyler »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: GetComponent Causes Lag
« Reply #1 on: September 20, 2019, 08:58:40 AM »
hi,

 yes, this is a Unity known slow api, that you should only use once and cache components

can you package the scene ? the template you sent is empty, there is not actions in it.

 if you only have GetComponent, then, the above applies, you must only use it once, and if you must use it several times, then plan differently, and have your component ready to be used in a centralized manner, so that the getcomponent api never gets called after you got your component.

 Bye,

 Jean
« Last Edit: October 10, 2019, 02:43:07 AM by jeanfabre »

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Re: GetComponent Causes Lag
« Reply #2 on: March 11, 2020, 11:58:56 AM »
To be clear, GetComponent causes lag of the FSM editor while NOT in Play Mode. Perhaps it is expensive at run time, but should it also be expensive to 'exist' inside an fsm in the editor?

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Re: GetComponent Causes Lag
« Reply #3 on: May 07, 2020, 06:11:04 PM »
BUMP: I made a video showing this bug, which I'm uploading right now to Youtube.
Editor Lag caused by the existence of Get/SetProperty and GetComponent actions in fsms.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: GetComponent/SetProperty Causes EDITOR Lag
« Reply #4 on: May 13, 2020, 02:56:39 AM »
Hi,

 Can you send me the project, I'll check on my side with the profiler as to what's going on.

Bye,

 Jean

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Re: GetComponent/SetProperty Causes EDITOR Lag
« Reply #5 on: May 14, 2020, 01:27:40 AM »
okay. my project is 8gb. should I put the fsm on an object in an empty scene and export that scene as a package? does that do it?

I tried using profiler record in edit mode with the Get Component action toggled on and off and typing words in the state label of the fsm, and I got these two images.

Not sure if this is it. but when the Get Component action is ticked enabled, I get like 777,000 garbage collection things.

In the normal image, we see wavy blue script bumps when i type letters, as I type them.
In the buggy image, there's a GIGANTIC blue "script" spike that starts when i start typing and ends seconds later, like it has frozen the profiler until it finishes as well.
« Last Edit: May 14, 2020, 01:56:17 AM by westingtyler »

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Re: GetComponent/SetProperty Causes EDITOR Lag
« Reply #6 on: June 07, 2020, 07:55:08 PM »
bump

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: GetComponent/SetProperty Causes EDITOR Lag
« Reply #7 on: June 10, 2020, 03:06:00 AM »
Hi,

 Send the whole project, even if big please, this is likely very much affecting the perfs.

Bye,

 Jean

westingtyler

  • Sr. Member
  • ****
  • Posts: 277
    • My Video Game Projects Web Site
Re: GetComponent/SetProperty Causes EDITOR Lag
« Reply #8 on: July 13, 2020, 05:56:44 AM »
hello. should I zip the project folder and put it in a dropbox link and send it to a private message or email somewhere? I don't want to violate any unity asset store policies by sharing the wrong dlls.

UPDATE: I sent a DM to a dropbox link with an empty project with an fsm that does the problem.
« Last Edit: July 13, 2020, 08:29:54 AM by westingtyler »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: GetComponent/SetProperty Causes EDITOR Lag
« Reply #9 on: July 14, 2020, 02:34:28 AM »
Hi,

 uhm, it's odd, I don't see what you are seeing at all, can you make a screen recording of your profiling session so that I understand what you are doing and when these pikes occurs?

Bye,

 Jean