Search Unity

Changes in scale made to prefab by script in Editor are lost when Played (All releases of 4.x)

Discussion in 'Editor & General Support' started by Tanoshimi2000, Apr 26, 2015.

  1. Tanoshimi2000

    Tanoshimi2000

    Joined:
    Feb 10, 2014
    Posts:
    46
    When scripts run in the Editor modify the scale (either lossy scale or local scale) of an object, the effect is visible in the editor. But when you run, those new scalings are lost, and the instance reverts back to it's prefab size. Since it's a SerializedField in a Serialized class, when you hit stop, the changes are restored.

    In Editor, item is scaled

    In Player, items reverts to prefab.

    Obviously, if I scale it by hand, the changes carry over to the Player, but the changes do not carry over if those changes were made by a script.

    Calling SetDirty(myInstanceOfPrefab); did not help either, which is why I think this is a bug. I've struggled with this in all versions of 4.