Sibling order results in bug

Discussion and help for Easy Save 3
Post Reply
vestigialdev
Posts: 1
Joined: Sun Jan 10, 2021 10:08 pm

Sibling order results in bug

Post by vestigialdev »

Hi, I'm having a problem that a field is null when loaded, DEPENDING on its sibling order.
I'm attaching a minimal project that (for me) demonstrates it. There are two unit tests in the test runner. One passes, the other fails. The only difference between them is they load a different prefab. The only difference between the prefabs is the sibling order. When the problem gameobject is first (sibling index 0) it loads successfully (its Node.Parent field retains is previous value).
But, with the failing unit test, pointing to the failing prefab, the problem gameobject comes after the other gameobject. Now when the scene is saved and loaded, its Node.Parent field is null.

A couple weird things I'm doing that might be causing it:
Doing this in a [UnityTest] unit test
Added an assembly definition file to EasySave/Scripts so the test assembly can access it
Creating the EasySave manager in the scene on-demand if one doesn't exist (then waiting a frame before continuing)
Loading assets via the AssetDatabase rather than Resources.Load() or some other way

It seems the project is too large to attach (30mb) so I'll PM it if anyone is interested
User avatar
Joel
Moodkie Staff
Posts: 4826
Joined: Wed Nov 07, 2012 10:32 pm

Re: Sibling order results in bug

Post by Joel »

Hi there,

Please could you private message the minimal project to me so I can see what is happening?

All the best,
Joel
Joel @ Moodkie Interactive
Purchase Easy Save | Contact | Guides | Docs | Getting started
Post Reply