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

Undo.SetSnapshotTarget is obsolete: Use Undo.RecordObject instead

Discussion in 'Scripting' started by AlanMattano, Sep 19, 2014.

  1. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,501
    Hello, still trying to learn Unity.
    One of my assets is giving me a lot of obsolete alerts and i want to learn.

    What i need to do with "CreateSnapshot" and "ClearSnapshotTarget" ?

    Is correct to change this code ?
    Code (csharp):
    1.  
    2.                         // Create a new snapshot.
    3.                         Undo.SetSnapshotTarget (p_target, p_name);
    4.                         Undo.CreateSnapshot ();
    5.                         Undo.ClearSnapshotTarget ();
    6.  
    with this new code?
    Code (csharp):
    1.  
    2.                         // Create a new snapshot. Unity 4.5
    3.                         Undo.RecordObject (p_target, p_name);
    4.                         // Obsolete: Undo.CreateSnapshot ();
    5.                         // Obsolete: Undo.ClearSnapshotTarget ();
    6.  
    I don't know what i'm doing and i'm afraid to loos my prefabs setups or to loos functions:
    CreateSnapshot and ClearSnapshotTarget.
    Is there anybody good to learn from at this night time?
     
    Last edited: Sep 19, 2014