Search Unity

Unity's version control component has been upgraded to Plastic SCM.

Collab losing references between existing prefab and new prefab

Discussion in 'Unity Collaborate' started by pakfront, Feb 26, 2017.

  1. pakfront

    pakfront

    Joined:
    Oct 6, 2010
    Posts:
    551
    We are using the standard Unity 5.5.0f3.

    We have a consistent problem. If a user creates a new prefab and adds it as a reference on an existing prefab, all other users, when they update, see that new reference as null.

    For example I have an existing prefab A with MonoBehaviour MyComponentA. To this component I add "public Transform theOtherThing;" I then create new prefab "OtherThingB" and drag it, in the Project view, to "theOtherThing" field of MyComponentA. It's definitely applied to the prefab, not an instance of the prefab in a scene.
    Submit changes.

    Another user updates. They get the new prefab OtherThingB, but the theOtherThing field in prefab MyComponentA is null. It should be a reference to OtherThingB.

    Is this a known issue or are we doing something wrong? Thanks.
     
    Last edited: Feb 26, 2017
  2. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi @pakfront! I'm sorry to hear that you're running into this issue :(. This behavior definitely shouldn't be happening. I haven't worked in that specific version in a while and wanted to see if I could repro it myself. Unfortunately I got swamped with other things and couldn't get to it today. I'll take a look as soon as I can tomorrow and have an answer for you then.
     
  3. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi again, @pakfront! I tried but wasn't able to repro your bug. Could you make sure to save changes to your project before you publish your changes and see if they are kept? How are you creating the new prefab OtherThingB? Can your other user use the Collab History window to go back to a previous revision where that change exists and see if the reference is still null there? Can either of you download the project to a new directory from the In the Cloud tab in the Launcher to see if the reference is null there too?
     
  4. pakfront

    pakfront

    Joined:
    Oct 6, 2010
    Posts:
    551
    Thanks for taking a look @ryanc-unity. We are able to reproduce this pretty regularly.

    All scene changes are saved before publish.
    The OtherThingB is created by creating a new GameObject in Scene, then dragging it out to the project.
    I have reproduced it by downloading it to a new folder on the same computer I committed from.

    I will try to set up a light weight example in my personal Collab space.
     
  5. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    No problem. I'm getting more eyes on this in the hopes that we can figure out what exactly is happening on your end. In the meantime, if you could submit a bug report with that light weight example and post the bug number here, that would really help us out.
     
  6. pakfront

    pakfront

    Joined:
    Oct 6, 2010
    Posts:
    551
    In my collab area I created project PrefabSyncIssuesA. I am _not_ able to reproduce the problem in this simple test. If we can isolate it to a simple reproducible bug I will certainly let you know. Thanks for your time.
     
  7. pedro_unity

    pedro_unity

    Joined:
    Jan 16, 2017
    Posts:
    172
    Hello @pakfront,

    I'm assisting @ryanc-unity in finding the cause to this issue. Thank you for helping us get to the bottom of this problem. I had a few additional questions for you:
    • You wrote: "They get the new prefab OtherThingB, but the theOtherThing field in prefab MyComponentA is null. It should be a reference to OtherThingB." Is that what the other users are seeing or would it be "none (Transform)"
    • Was prefab OtherThingB renamed at any point?
    Thank you for your help!
     
  8. pakfront

    pakfront

    Joined:
    Oct 6, 2010
    Posts:
    551
    Hello @pedro_unity,
    I have an update - we get this behavior when we edit a prefab within the "Project" view. Specifically when dragging a reference of one component of a prefab onto the object field of another component of the same prefab.
    I noticed that this does not trigger a Collab diff, that is the Collab icon remains a green check box.

    We can get around this by adding GetComponent in Awake(), or by doing all our Prefab editing in a Scene and then using "Apply" but it is troublesome.

    • You wrote: "They get the new prefab OtherThingB, but the theOtherThing field in prefab MyComponentA is null. It should be a reference to OtherThingB." Is that what the other users are seeing or would it be "none (Transform)"

    You are correct. it reads "none"
    • Was prefab OtherThingB renamed at any point?
    No
     
    Last edited: Mar 5, 2017
  9. pedro_unity

    pedro_unity

    Joined:
    Jan 16, 2017
    Posts:
    172
    Thank you @pakfront !

    Due to your help, we've been able to reproduce the issue and are actively investigating how to fix it. I will post the Fogbugz ID here so that you can track its resolution. I sincerely apologize for any confusion or issues this might have caused during the development of your game/product and thank you for your patience as we fix these defects. Feel free to reach out if you have any questions.

    Cheers!
     
    pakfront likes this.
  10. pedro_unity

    pedro_unity

    Joined:
    Jan 16, 2017
    Posts:
    172
  11. SbaerO

    SbaerO

    Joined:
    May 3, 2017
    Posts:
    1
    Just coming here to comment on our similar situation for a university student project of six people working in version 5.5.0f3.

    As novice game developers we didn't know why we had to spend so much time fixing null reference errors from collaborate (9 week development cycle). We ended up resorting to making as many private references through code as possible to circumvent the problem.

    Since you've been able to reproduce the problem and its been a couple months since then I'm glad you guys are on it and we hope you find a solution.
     
  12. tonOnWu

    tonOnWu

    Joined:
    Jun 23, 2017
    Posts:
    83
    Hey, guys.
    I'm still having this problem in 2020 with Unity 2019.3.13f1. Any news about how to solve it? I already tried all suggestions I found on Internet... and nothing.

    Thanks.
     
  13. Ryan-Unity

    Ryan-Unity

    Joined:
    Mar 23, 2016
    Posts:
    1,993
    Hi @tonOnWu, could you go into more details about how the issue you're seeing compares with the one of the original poster? Are you seeing references missing on a script or prefab?