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
10
Question by vexe · Feb 16, 2014 at 04:29 PM · editorserializedobject

What does SerializedProperty.Update exactly do?

Hello,

I understand that using SerializedProperty.ApplyModifiedProperties will apply any modified values and changes been made to a SerializedObject, otherwise the won't get reflected to the target object.

But I never understood why do I need to do a SerializedObject.Update at the top of any editor script.

The doc is very poor, all it says "Update serialized object's representation." - you don't say!

What does this mean? what does it do? and why do I need it?

Thanks!

Comment
Add comment · Show 5
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 whydoidoit · Feb 16, 2014 at 04:31 PM 1
Share

Well I do have to use that somewhere - but don't have the code to hand right now so I will try to remember and if no one posts then I'll look it up when I can.

I'm pretty sure that it updates the SerializedObject/Property representation from the variables you have set in the actual class.

avatar image whydoidoit · Feb 17, 2014 at 04:08 AM 1
Share

Yeah so I use it when I have an inspector that uses serialized objects etc and I cause something to change with sideeffects using normal code during my processing. It updates the serialized object structure to represent the current state after the side effects.

avatar image vexe · Feb 17, 2014 at 04:10 AM 1
Share

Hmm, example? - "cause something to change" - hmm, sounds like calling Apply$$anonymous$$odifiedProperties would apply the changes here?

avatar image whydoidoit · Feb 17, 2014 at 04:26 AM 2
Share

No that applies the properties you've modified in the serialized object to the actual class, Update is the other way around.

avatar image vexe · Feb 17, 2014 at 04:29 AM 1
Share

So Update fetches the values from the class, to the object, and Apply will push the values back to the class? is that it?

1 Reply

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

Answer by whydoidoit · Feb 17, 2014 at 04:31 AM

Yep that was what I was trying to say ;)

Update = set serialized object stream now based on what is in the actual class

ApplyModifiedProperties = take what is in the object stream and put it in the class

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

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Get UnityEvent reference from SerializedProperty 1 Answer

Triggering updates in a custom EditorWindow 0 Answers

What exactly does UpdateIfDirtyOrScript() do? 0 Answers

Display function parameters in inspector 0 Answers

Serialized Property being uneditable in certain cases 0 Answers


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