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
0
Question by DocteurCox · Jul 30, 2013 at 01:35 PM · c#editorserializedpropertythis

Get "this" SerializedProperty ?

Hello there,

I'm working on something to make my life easier with Editor scripts and for a matter of simplicity of my code I'm looking for a way to work the same way with both SerializedObject and SerializedProperty. I could use an adapter pattern, but before I do that, I would like to know if there's an easier way. :)

Unless I am mistaken, there's no way to use polymorphism to work the same way with SerializedObject and SerializedProperty when it comes to finding relative SerializedProperty. So I was wondering : is there a way to get a root SerializedProperty ? (that is to say a SerializedProperty that reflects its SerializedObject)

Thanks in advance for your answers :)

Comment
Add comment
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

1 Reply

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

Answer by Bunny83 · Jul 30, 2013 at 02:35 PM

No, that's not possible. You should understand how the serialization actually works. If you have Unity pro, make sure you force text serialisation, then just open a prefab or a scene in a text editor.

A SerializedObject represents one object that is serialized on it's own. Only Components and build-in reference types are actually serialized on their own. "Normal" custom serializable classes are serialized along is an actual SerializedObject. All the members of the custom class or array become properties of the SerializedObject. Between real SerializedObject it only holds references. So each SerializedObject is on it's own but objects / values that are serializable but not SerializedObjects will become properties of the containing SerializedObject.

Comment
Add comment · Show 1 · 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 DocteurCox · Jul 30, 2013 at 02:44 PM 0
Share

Ok. I don't have Unity Pro so I never had a chance to look at how Unity's serialization works, but now I think I get it :) Thanks for those very clear explanations :)

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

16 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

Related Questions

Select custom object from a list via PopUp in custom editor for ScriptableObject 0 Answers

Easy way to set multiple SerializedProperties 1 Answer

Handling Undo/REdo in EditorWindow when editing DB record. 0 Answers

How to access elements in an array through a SerializedProperty? 1 Answer

Initialising List array for use in a custom Editor 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