Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

"Cannot destroy GameObject that is part of a prefab instance" when building asset bundles

Discussion in 'Prefabs' started by james7132, Sep 17, 2018.

  1. james7132

    james7132

    Joined:
    Mar 6, 2015
    Posts:
    166
    Code (CSharp):
    1. Error building Player: Cannot destroy GameObject that is part of a prefab instance.
    2. UnityEditor.BuildPipeline:BuildAssetBundles(String, BuildAssetBundleOptions, BuildTarget)
    Unity 2018.3b1, occurs when trying to build asset bundles, regardless of build target or settings.

    Working on trying to reproduce this in a smaller project, will file a bug when I have it ready.
     
    Last edited: Sep 17, 2018
  2. grobonom

    grobonom

    Joined:
    Jun 23, 2018
    Posts:
    335
    got same message twice when building.
    strangely it don't prevent the building process to finish successfully...
     
  3. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    This probably happens because of GameObjects with EditorOnly flag in prefabs.

    There is a fix coming in a future beta.
     
  4. grobonom

    grobonom

    Joined:
    Jun 23, 2018
    Posts:
    335
    oh okay !!!! thanks a lot SteenLund !!!
    lemme rush on the latest .5 beta then ;-)
     
  5. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    Unfortunately I think you have to wait to beta 6 or 7. Even though the issue is fixed getting it through the release pipeline can take a little while.
     
    Last edited: Oct 12, 2018
    LeonhardP likes this.
  6. grobonom

    grobonom

    Joined:
    Jun 23, 2018
    Posts:
    335
    awwwww so many issues with betas....
    i wish i had time to waste with all this :((
    thanks anyway :))
     
  7. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,132
  8. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    536
    Hi @LeonhardP and @SteenLund
    The issue, or one similar still exits, and I can even said appeared in 2021.1.1f1 compared to 2019.3.6f1. I opened an issue, ticket 1363573 in fogbugz. The difference with the OP is that the error appears when exiting playmode.
     
  9. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    3,132
    Thanks for submitting a bug report for this @Aka_ToolBuddy. QA will look into it.