playMaker

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

westingtyler

  • Sr. Member
  • ****
  • Posts: 268
    • View Profile
    • My Video Game Projects Web Site
GetComponent/SetProperty Causes EDITOR Lag
« on: September 20, 2019, 05: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, 03:13:23 PM by westingtyler »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15284
  • Official Playmaker Support
    • View Profile
Re: GetComponent Causes Lag
« Reply #1 on: September 20, 2019, 05: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 09, 2019, 11:43:07 PM by jeanfabre »

westingtyler

  • Sr. Member
  • ****
  • Posts: 268
    • View Profile
    • My Video Game Projects Web Site
Re: GetComponent Causes Lag
« Reply #2 on: March 11, 2020, 08: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: 268
    • View Profile
    • My Video Game Projects Web Site
Re: GetComponent Causes Lag
« Reply #3 on: May 07, 2020, 03: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: 15284
  • Official Playmaker Support
    • View Profile
Re: GetComponent/SetProperty Causes EDITOR Lag
« Reply #4 on: May 12, 2020, 11:56:39 PM »
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: 268
    • View Profile
    • My Video Game Projects Web Site
Re: GetComponent/SetProperty Causes EDITOR Lag
« Reply #5 on: May 13, 2020, 10:27:40 PM »
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 13, 2020, 10:56:17 PM by westingtyler »

westingtyler

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

jeanfabre

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

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

Bye,

 Jean