Search Issue Tracker

Fixed

Votes

22

Found in

4.2.0b2

Issue ID

549533

Regression

No

Cannot add assets to a ScriptableObject asset with AssetDatabase.AddObjectToAsset

Scripting

-

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 (16)

  1. 6ddeb6c2732c0b28d8aeb1955ef1eda1?d=mm

    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 :)

  2. 7fb545016e6564beeae4544995d043d1?d=mm

    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.

  3. 6243cfccee6ef4135db6a7583ab7b46e?d=mm

    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.

  4. 2dfb23204c2e939baffa10c5e3790cb6?d=mm

    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.

  5. 5bf8f46fa088e935bde044785ba73a2d?d=mm

    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!)

  6. B797449429747ef4341b4939a00b2ce8?d=mm

    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.

  7. B797449429747ef4341b4939a00b2ce8?d=mm

    Flavelius

    Apr 21, 2016 08:57

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

  8. 4b557aa04a755c16640a676cfa03f6f8?d=mm

    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.

  9. 4b557aa04a755c16640a676cfa03f6f8?d=mm

    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.

  10. Bff97b12e7d23a9ea9b65d9bd5cc2623?d=mm

    winxalex

    Apr 08, 2016 10:21

    Bug Not solved. Sub asset become main asset. U 5.3.3p2. Only way to do it is to set
    subAsset.HideFlags=HideFlags.HideInHierachy before add. Then you out of Debugging option. Shame on Unity.

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.