Closed Rylius closed 3 weeks ago
Pushed some changes that help this a bit, I'll see what else I can do:
Spawning [GameObject:prefab_with_action](arg:0) x1000 took 173.0877ms (avg 0.1730877ms)
Spawning [GameObject:prefab_without_action](arg:0) x1000 took 29.7203ms (avg 0.0297203ms)
I think there's no more easy wins so I'll close for now.
Describe the bug
Cloning prefabs which contain action graphs is significantly slower than identical prefabs without the graph.
Ran into this in my game jam project when I implemented a shotgun spawning 10 projectile prefabs at once, which made the game stutter. Worked around it by moving the graph to code, which wasn't exactly ideal.
To Reproduce
actiongraph_slow_clone_repro.zip
There's two objects spawning a 1000 prefabs each. The prefabs are identical, but only one of them contains an action graph. (The action graph itself is nonsensical and doesn't even get executed.)
It gets even worse with larger action graphs. Just duplicating all nodes twice makes it take over 3 seconds in this example.
Expected behavior
Cloning prefabs with action graphs shouldn't take this much longer.
Media/Files
Additional context
No response