First of all
-
I am trying to speed up my game’s loading speed
-
We are using Addressables and VisualScripting in Unity 2021.3.17f1
-
Both packages were up to date
-
This post below were focus on these types
Current state
- We put npc logic in ScriptMachine with macro in its prefab
- Use Addressables.InstantiateAsync to create the npc instance one by one
- It just works fine, BUT SLOW, VERY SLOW
What I am trying to do is Instantiate all the npcs at once, not one by one
- In this change, we seems meets VisualScripting’s Deserialize bug
- By my try and error study result, the bug seems caused by LudiqBehaviour.OnAfterDeserialize API’s first return code
What I wanna ask is
-
Is this is a rule of VisualScripting?
-
User should not Instantiate prefab with LudiqBehaviour at the same time?
-
Or there is a checkbox or something else I can do? for Instantiate prefabs at the same time correctly?
-
I’ve tried a lots of way for this, include update Unity to 2022.2.18f1, but they were all not success
For Sample Project
- I’m cleaning up my code, I’ve written too many tests and it’s looking pretty messy at the moment
- I’ll provide it later if need
What I’ve tested
-
Update all package and Unity
-
Not works
-
Store SerializationData _data; value in my script, and try to fix the buged instance with my data
-
It seems works, but there is some edge case not works, and I don’t really have enough condition to judge which LodiqBehaviour data is broken now
-
Store ScriptGraphAsset reference in my script, and restore it into ScriptMachine while machine is broken
-
It works, but there is some edge case, that nest.macro is not null but hold an empty graph
-
And it is not a good idea to fix missing Variables
-
Load Asset from Addressables, and than Instantiate with Addressables
-
It works, on Editor only, not works on mobile device
-
Load Asset from Addressables, and than Instantiate by Object.Instantiate API
-
It works, on Editor only, not works on mobile device