Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 ifdef_ben · Apr 18, 2016 at 05:13 PM · editorserializationcustom editorcustom-inspectorobject reference

Editable non-monobehaviour objects

Hi,

I'm working on a tool where I need to populate a custom path-finding "database" with objects that can be visualized and manipulated in the editor's viewport and inspector.

However, all I need to do in play mode is access properties with the path-finding manager and I don't need any code executed at all in these objects as the database does not change during the execution.

I know it would be easy to edit and visualize all of those database objects by making them inherit Monobehaviour and use either gizmos or handles and a custom inspector, but doing so would make some code run on execution. Even if I used the [ExecuteInEditMode] property or preprocessor directives to hide update functions and so at compilation, the default Monobehaviour functions would still be called in the background. As the database is expected to be rather big (probably a few thousands elements) using monobehaviour components seems like a big waste of CPU for classes that are essentially passive on execution.

I've tried using the [System.Serializable] property but I need to be able to make references between the database elements ( object_A is connected to object_B ) and it does not seem supported with serialized classes, but I might be wrong.

So for a quick recap, I'm looking for an efficient way to do this:

  • Visualize and edit objects with spacial properties in the scene for populating a database.

  • Be able to set object references in properties ( object_A is connected to object_B ).

  • In play mode, objects need to be completely passive as there will be a whole lot of them and I only need access to their properties.

I'm new to Unity and I might be missing some basic principles here, but I've been searching on this for many days now and I haven't found any answer regarding this.

Thanks a lot for your help!

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
0
Best Answer

Answer by ifdef_ben · Apr 21, 2016 at 05:16 PM

Humm okay it turns out the solution was to use ScriptableObject instead of Monobehavior objects.. Thanks anyways guys!

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

ScriptableObject with Custom Editor resetting data in inspector 1 Answer

Null reference exceptions when using a Custom Editor 0 Answers

Using a custom editor script with a prefab instance causes my variables to reset on Play 3 Answers

EditorWindow: How to Serialize variables after PLay 1 Answer

How can i get SerializedProperty from UnityEvent which in List. Sorry for my Eng. 2 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