Search Unity

"Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption"

Discussion in 'UGUI & TextMesh Pro' started by Marble, Nov 7, 2014.

  1. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,268
    After upgrading my project to f1, I get this new error in UnityEngine.UI.ScrollRect:LateUpdate():

    Code (CSharp):
    1. "Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption"
    There is no more information so I can't tell where it's coming from, except that it probably has to do with me setting a scrollRect parent for an instantiated prefab. My scripts worked fine in b21.

    I want to create a repro, but I don't know what I could be doing wrong that I wasn't before. Weirdly, I get a bunch of InputField carets at the root of my hierarchy that come back with me to whatever scene I started in. So if I load the main menu of my game, then enter a scene where the error is thrown, then exit playmode, I'll have a bunch of InputField carets just chilling in my main menu hierarchy!
     
    Last edited: Nov 7, 2014
  2. Marble

    Marble

    Joined:
    Aug 29, 2005
    Posts:
    1,268
    I've narrowed down and reported the bug: Case 646265

    The error occurs when you load a scene at runtime that contains an InputField prefab instance. It does not affect any runtime functionality, but it does proliferate InputField carets infinitely in the hierarchy even after exiting play mode. o_O
     
  3. Kesh

    Kesh

    Joined:
    Jan 13, 2014
    Posts:
    21
    Yes, this is most annoying. I think I have accumulated 20 carets in my scene in the past hour.
     
  4. AridOcean

    AridOcean

    Joined:
    Jul 16, 2013
    Posts:
    10
    Same problem here. I hope this gets fixed soon.
     
  5. Exorion

    Exorion

    Joined:
    Mar 15, 2015
    Posts:
    5
    Still not resolved, happening to me right now.
     
  6. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    I honestly don't mean to sound impolite, but are you guys trying to set the parent of a prefab?
     
  7. IngeJones

    IngeJones

    Joined:
    Dec 11, 2013
    Posts:
    129
    The posters from 2014 probably found an actual bug which is long-fixed as of 2017, but it's worth finding out if Exorion (posting today) is making some mistake.
     
  8. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    lol I kinda thought of that after I posted, because it appeared new.. But yes, just in case Exorion is :)
     
  9. Exorion

    Exorion

    Joined:
    Mar 15, 2015
    Posts:
    5
    Thanks for you concern, but no I'm not trying to set the parent of a prefab. I instantiate my prefabs with Instantiate(prefab, parent) where the parent is NOT itself a prefab. It's a small game, where there's almost to none to spawn so yeah. The stacktrace talks about a ScrollRect tho, that I do have in my scene but no script is affecting it whatsoever.

    Edit : BTW, the game works just fine, no errors, even after testing and compiles perfectly
     
  10. Exorion

    Exorion

    Joined:
    Mar 15, 2015
    Posts:
    5
    More insight : The caret that's spawned has the name of the object in it, so it's coming from an InputField which has its placeholder removed. I removed the input field, placed another with the exact same values, problem fixed. The caret was instantiated as a child of Input Field. So yeah, I do believe the bug still happens.
     
  11. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    Glad it's fixed for you, by that action, nonetheless. :)
     
    Exorion likes this.
  12. Exorion

    Exorion

    Joined:
    Mar 15, 2015
    Posts:
    5
    Oooh I get it. I used the Copy Component Values feature on a ScrollRect component, from a prefab, and apparently this feature also copies the debug values so when I pasted it on my object, it had the prefab values.
     
    IngeJones likes this.
  13. methos5k

    methos5k

    Joined:
    Aug 3, 2015
    Posts:
    8,712
    That's insightful. I wouldn't have thought of that right away :)
     
  14. IngeJones

    IngeJones

    Joined:
    Dec 11, 2013
    Posts:
    129
    Exorion thanks for posting again to let us know what it actually was. Useful future reference.
     
    Exorion likes this.