playMaker

Author Topic: instantiating 1000 Gameobject with FSM attached, causes huge FPS impact on build  (Read 838 times)

JBAN

  • Playmaker Newbie
  • *
  • Posts: 4
Hello,
I have several years of experience in Unity and C#, and now playing with Playmaker to speed up production. It is a great tool, but I am stuck and on the fence about continuing utilising it...

In one of my early tests. I have noticed a big performance drop by simply instantiating 1000 Gameobjects (2D physics and unlit shader) with and without FSM components on each instantiated gameobject. (empty FSM states)

I got 246fps. in the test without FSM component and 195fps. in the test with clean FSM components. (Windows build), but also noticed drops on Android.

There is nothing fancy on the scene or additional scripting that could be distorting the results, I am testing with the latest LTS Unity version on a clean scene, no lit shaders, lights, etc.

Thank you for your thoughts.

wetcircuit

  • Full Member
  • ***
  • Posts: 158
    • wetcircuit.com
A test against "nothing" is not a real test.

What were the frame rates when you instantiated 1000 gameobjects with other arbitrary monoscript components attached?

In any real-world scenario, the option is not 1000 game objects with/without fsm… the option is 1000 game objects with FSM, or some other solution that accomplishes the same goals.

A scene manager that cycles through an array of the 1000 objects, or that cycles through the 100 nearest objects, or some other re-engineering of the loop is a more likely solution than instantiating 1000 game objects that do nothing because they have no scripting attatched.

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Instantiating 1000 objects is a lot of garbage, what did you expect?
Available for Playmaker work

JBAN

  • Playmaker Newbie
  • *
  • Posts: 4
The topic is not about how good or bad is instantiating 1000 Gameobjects, but the impact of c# or FSM components on them.

JBAN

  • Playmaker Newbie
  • *
  • Posts: 4
A test against "nothing" is not a real test.

What were the frame rates when you instantiated 1000 gameobjects with other arbitrary monoscript components attached?

the frame drop produced by instantiating gameobject with FSM  clean components is big enough that the suggested test is not delivering additional information (in this scenario), as I am able to attach expensive c# components instead of empty FSM components and yet still get better performance with c#.

I suspect FSM could be breaking GPU Instancing... I'll keep looking at what exactly is going on here as I am really looking forward to keeping using Playmaker to speed up production.
 

wetcircuit

  • Full Member
  • ***
  • Posts: 158
    • wetcircuit.com
FWIW, I believe FSMs are compiled into C# on build. (You don't say whether you are comparing builds, or in-editor).

I'd still be wary of tests that don't look like any real use. You will collect data that is very specific, but not applicable.

JBAN

  • Playmaker Newbie
  • *
  • Posts: 4
tested on Windows build. I am actually updating an app developed before using instantiated Gameobjects, and regardless there are better approaches instead of instantiating many Gameobjects, performance wasn't an issue before using c#.

I am not pointing fingers yet to FSM as I think there is still room to determine the cause of the issue. It could well be Unity itself or something I am missing out from this simple test.

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Do let us know, i'm really interested in further testing. I made a game with lot of pooling of the objects that have tons of FSM's and the loading performance is horrendous.
Available for Playmaker work