Search Unity

Problems with ApplyModifiedProperties and multi scene editing

Discussion in 'Editor & General Support' started by dodderz, Oct 9, 2017.

  1. dodderz

    dodderz

    Joined:
    Apr 20, 2015
    Posts:
    6
    I have a problem where a scriptable object has a custom inspector and when ApplyModifiedProperties is called it sets all open scenes to be dirty, rather than just the scene that contains the scriptable object (the scriptable objects are in an array on a monobehaviour in one scene). Presumably this is because a scriptable object doesn't have a notion of being in a scene.

    Is there a workaround for this?
     
  2. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    393
    I have the exact same issue. Did you find a workaround?
     
  3. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,282
    Can you file a bug report? We may be able to fix this in the future.
     
  4. silentslack

    silentslack

    Joined:
    Apr 5, 2013
    Posts:
    393
    Done! Hopefully this one gets resolved soon, my save time on all loaded dirty scenes is about 20 seconds :(
     
    karl_jones likes this.
  5. hedgehog90

    hedgehog90

    Joined:
    May 18, 2016
    Posts:
    27
    I've also submitted a bug report.
    I've found this only occurs with floating ScriptableObjects - ones that aren't saved as assets.
    You can get around it with ApplyModifiedPropertiesWithoutUndo(). Not ideal, but a quick fix for now.

    However, I noticed this dirties the scenes:
    Undo.RecordObject(object, "undo");
    serializedObject.ApplyModifiedPropertiesWithoutUndo();

    The real culprit is Undo.
     
    Last edited: Jan 23, 2018
  6. hedgehog90

    hedgehog90

    Joined:
    May 18, 2016
    Posts:
    27
    Just got an email back from Unity, the bug's been confirmed and it should be resolved in an upcoming build.
     
    karl_jones likes this.