Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug About LudiqBehaviour OnAfterDeserialize step

Discussion in 'Visual Scripting' started by KevinZhuEdu, May 10, 2023.

  1. KevinZhuEdu

    KevinZhuEdu

    Joined:
    May 4, 2023
    Posts:
    6
    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
      • <LudiqBehaviour>
      • <SerializationData>
      • <ScriptMachine>
      • <Variables>
    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
     
  2. KevinZhuEdu

    KevinZhuEdu

    Joined:
    May 4, 2023
    Posts:
    6
    upload_2023-5-10_16-18-51.png
    The code of the first return
     
  3. KevinZhuEdu

    KevinZhuEdu

    Joined:
    May 4, 2023
    Posts:
    6
    Here is sample project, and how to reproduce bug
    Reproduce bug on UnityEditor
    • Open Unity with Android platform target
    • Open Addressables Group Window (Only once if need)
      • Build / New Build / Default Build Script
      • Play Mode Script > Use Existing Build (Android)
    • Oepn SampleScene
    • Enter runtime play mode
    • Hit AtOnce series button
    Reproduce bug on Mobile
    • build apk
    • install apk
    • launch game
    • Hit AtOnce series button
    Note
    • Bug will not always appear directly, if the console did not appear any RED message, try again with AtOnce series button
    • The 1 by 1 series button is current logic of our game, it won’t occurs bug, but VERY SLOW
    • The last gui on the top menu is a drop down, it can switch 3 kinds of load logic
      • Instantiate Only, can reproduce bug easily on Editor
      • Load Asset Before InstantiateAsync, can ease bug on Editor
      • Load Asset and Instantiate, can ease bug on Editor, it skipped Addressables InstantiateAsync api
     

    Attached Files:

  4. KevinZhuEdu

    KevinZhuEdu

    Joined:
    May 4, 2023
    Posts:
    6
    Unity QA has confirmed this bug
    Let's wait for good news~
     
  5. KevinZhuEdu

    KevinZhuEdu

    Joined:
    May 4, 2023
    Posts:
    6
    In my guess, it could be fix in more than 1 year later -.,-
    Unity ~ PLEASE PROVE ME WRONG