Search Issue Tracker




Found in


Issue ID




Cannot add assets to a ScriptableObject asset with AssetDatabase.AddObjectToAsset



In case the main Asset is a ScriptableObject, AssetDatabase.AddObjectToAsset (subObj, mainAsset) "mixes up" incoming parameters and adds the scriptable obj to a sub object

Expected: Vice versa.

Comments (17)

  1. Rodolfo-Rubens

    Sep 11, 2020 04:58

    Not fixed, I'm having this issue in 2019.4.7f1...

  2. Shrikky23

    Sep 06, 2016 23:11

    I have reproduced the bug and reported it . Also produced workarounds so you can pin point the bug and fix it fast. Looking forward to the fix :)

  3. rune_unity

    Aug 17, 2016 14:10

    Note: If anyone are still seeing this bug, we need a new bug report for it. The repro steps and project attached to this specific bug report do no longer reproduce any problem, so if a bug is still there, it only manifests itself in a different way that we don't have a bug report for and don't currently know how to reproduce.

  4. ataxkt

    Aug 12, 2016 09:03

    Still not fixed as of 5.4.
    Hiding or naming sub assets so that they're automatically placed further in sorting order still works as a hack.
    A neat enough fix is to prefix the name of all sub assets with the name of the master asset.

  5. samsamm777

    Jun 07, 2016 20:56

    Bug not fixed. Getting this issue in 5.3.4f1.

    The child asset comes the parent and therefore breaks the database.

  6. mudart

    Jun 06, 2016 14:33

    Bug Not solved. Sub asset become main asset. U 5.3.5p2 (trick with sorting algorithm working - 0mainAsset and 1subAsset...but it's terrible!)

  7. Flavelius

    Apr 21, 2016 09:10

    The only thing that makes it kind of work (unusable though) is to give it a special name, that makes the sorting algorithm put it to the front like 0mainAsset, but if you have a subasset whose name starts with something that gets sortet before that, like 0asset you're out of luck.

  8. Flavelius

    Apr 21, 2016 08:57

    I still have this issue even when i change the name before adding it to the mainAsset.

  9. ecesis_llc

    Apr 20, 2016 05:10

    Update: It does seem to work if I change the name of the Scriptable Object before adding it. Yay!

    Yep, I can confirm. The bug persists if no name is given to the ScriptableObject. If the object has a name before being added the hierarchy works. If there is no name the hierarchy becomes messed up.

  10. ecesis_llc

    Apr 20, 2016 05:06

    This still appears to be an issue in U5.3.4f1.

    I created a ScriptableObject container and saved it to an .asset. I have another ScriptableObject class. Using CreateInstance I then add this new ScrtiableObject to the container using AddObjectToAsset. The hierarchy is all messed up in the editor. HideInHierarchy at least keeps the container visible at the root. It looked like there was a "fix" back in 5.3.3p1. But it isn't working.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.