Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by Jessy · Mar 04, 2011 at 08:18 PM · custom-inspectorundo

How do you emulate the undo system with custom inspectors?

In the Unity Editor, any changes you make in the default Inspectors can be undone, nicely. I want to do this with custom inspectors too. I'd just like any code example; I didn't have luck with whatever I tried last time.

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Demigiant · Apr 02, 2011 at 09:29 AM 1
Share

Hey Jessy, I started a bounty on my undo question (http://answers.unity3d.com/questions/44888/how-to-correctly-register-undos-in-custom-inspector-within-oninspectorgui)... Hope someone will know a valid answer :P

avatar image Demigiant · Apr 03, 2011 at 04:48 PM 1
Share

Hey Jessy, with some help I found a fully working solution :) Look at my original answer for the right code (I edited it and added an example). The given answers weren't correct, but helped me a lot.

avatar image Adam-Buckner ♦♦ · Sep 08, 2011 at 12:58 PM 0
Share

Seems the pages have gone missing (due to software update??)

Could this be the page mentioned with Danele's answer: http://answers.unity3d.com/questions/50954 ????

avatar image Romeno Adam-Buckner ♦♦ · Apr 11, 2019 at 11:44 PM 0
Share

Izitmee's question is http://answers.unity3d.com/questions/44888/how-to-correctly-register-undos-in-custom-inspector-within-oninspectorgui

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Statement · Apr 02, 2011 at 04:25 PM

http://answers.unity3d.com/questions/45880/ Does that help?

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jessy · Apr 18, 2011 at 02:56 AM 0
Share

That helps the question you're helping me with tonight*, and you helped $$anonymous$$e come to the answer for the question in her comments above, which was most enlightening. Thanks. *http://answers.unity3d.com/questions/53143

avatar image Adam-Buckner ♦♦ · Sep 08, 2011 at 12:57 PM 0
Share

Seems the pages have gone missing (due to software update??)

Could this be the page mentioned with Danele's answer: http://answers.unity3d.com/questions/50954 ????

avatar image Bunny83 · Sep 08, 2011 at 08:21 PM 0
Share

Unfortunately you have to use the full url of the question. It's a pity that you can't view the question just by id...

http://answers.unity3d.com/questions/50954/how-to-correctly-register-undos-in-custom-inspecto.html

avatar image
3

Answer by burnumd · Mar 04, 2011 at 09:10 PM

What did you do last time? I've successfully used features of the Undo class in inspectors in the past. What you're attempting to undo influences how I'd recommend you use it (and any code samples I could offer), but the class documentation is robust enough to tell you when to use RegisterUndo and RegisterSnapshot. If that's what you were using before, be sure to let everyone know and maybe someone can come up with an alternate solution.

ETA: Here's an example of how I've used Undo.RegisterUndo in an inspector before:

GameObject tempObject = (GameObject)EditorGUILayout.ObjectField (((MyClass)target).myObject, typeof(GameObject));
if (tempObject != ((MyClass)target).myObject)
{
    Undo.RegisterUndo (new Object[1] { target }, "Set Object");
    ((MyClass)target).myObject = tempObject;
}
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Custom Inspector Undo Functionality when directly changing SerializedProperties 1 Answer

How to correctly register Undos in Custom Inspector (within OnInspectorGUI)? 4 Answers

How to Undo SharedMaterial set in CustomEditor? 1 Answer

Calling RegisterCreatedObjectUndo on an Asset is buggy 0 Answers

Behaviour of custom inspector on Undo 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges