Author Topic: GetComponent Causes Lag  (Read 221 times)


  • Full Member
  • ***
  • Posts: 236
    • View Profile
    • My Video Game Projects Web Site
GetComponent Causes 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. 

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.

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


  • Administrator
  • Hero Member
  • *****
  • Posts: 14832
  • Official Playmaker Support
    • View Profile
Re: GetComponent Causes Lag
« Reply #1 on: September 20, 2019, 05:58:40 AM »

 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.


« Last Edit: October 09, 2019, 11:43:07 PM by jeanfabre »