Data Lost on scene gameobject when create a prefabs

Issue #293 on hold
PuzzledBoy created an issue

This is a new issue left after #280 fixed , because the origin 280 issue already fixed, I think it's more proper to create a new issue for it.

Version : 1.0.6.1 Beta - Prefab Modification Hotfix.

Here is the steps:

  • Create a new Scene.
  • Create a new Script:
    public class TestOdin : SerializedMonoBehaviour
    {
        public DataBase data;
    }

    public abstract class DataBase
    {
        public GameObject go;
    }

    [Serializable]
    public class Data1 : DataBase
    {

    }
  • Create an empty GameObject1,add the Script "TestOdin" to it.
  • Create another empty GameObject2, assign it to the field "go" at GameObject1.
  • Drag GameObject1 to project window to create a prefab.
  • Click the GameObject1 at scene,the field "go" lost it's reference.

Comments (4)

  1. Bjarke Elias

    Thanks for reporting this one. And sorry for the inconvenience on this issue. But we'll have to put it on hold for a bit until our prefab-modification guru comes back and saves the day, which he will in 2 months time.

    A quick workaround for you could be to simply make a clone of the object, before making a prefab and use that to assign the lost scenes references.

  2. Tor Esa Vestergaard

    To give a status update on this, I've had a look at it, and it's actually an edge case known to me, that is related to how Unity handles prefab creation - without ever telling us that it happens. I am not certain a fix for this is possible, but I will leave the issue around and dedicate some time to really give it a solid go before I determine whether or not a fix is possible.

  3. PuzzledBoy reporter

    Thanks for your reply.

    well, it's sad to know that :( We make a Visual scripting system base on Odin and Abstract class(Glad to share to 'make with odin' in the future), and we use the system to build games. We can't use prefabs as we expected because of this issue, reassign the lost data always annoying. But I also understand the trouble you meet now, so... just let me know if you finally find out a solution.

    Good luck and thanks again..

  4. Log in to comment