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 /
  • Help Room /
avatar image
0
Question by rd1349 · Oct 05, 2018 at 10:52 AM · scriptableobjectmonobehaviourexecuteineditmode

ScriptableObject ExecuteInEditMode issue

Hello everyone. I'm busy building a CustomInspector for the artists in my office so they can create items without having to know code. This whole thing has been way easier in theory than it has been in practice.

My current problem is that I want to use ScriptableObject instead of MonoBehaviour but the code I've written requires some stuff to use [ExecuteInEditMode], when I change the script from MonoBehaviour to ScriptableObject [ExecuteInEditMode] stops working.

Does anyone know if it's possible to use [ExecuteInEditMode] in a ScriptableObject? If it is I'd greatly appreciate a pointer or two.

Comment
Add comment · Show 1
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 Glurth · Oct 05, 2018 at 04:31 PM 0
Share

Check out: EditorApplication.update https://docs.unity3d.com/ScriptReference/EditorApplication-update.html

This delegate event allows your code to be called back, every cycle in the editor. Still, I would recommend you follow Bunny83 advice on what kind of code to put in there. (e.g. you may wish to create a separate editor component class for your scriptable object, and use THAT to perform whatever editor-functionality you need, including subscribing to EditorApplication.Update.)

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · Oct 05, 2018 at 11:29 AM

Uhm a scriptableobject has almost no callbacks at all. It only has Awake, OnEnable, OnDisable and OnDestroy. What exact behaviour do you expect from ExecuteInEditMode ? Have you read the documentation? It only applies to MonoBehaviours since ScriptableObjects do not have any callbacks besides the 4 i've mentioned already. Those callbacks are actually called in the editor as well.


Finally note that ExecuteInEditMode is not meant to implement editor functionality. It's only meant to provide the runtime functionality to be active at edit time. For example a particle system that should update during edit mode. However it should not be used to implement actual editor features. You haven't said a word about what you're actually doing so we can't help you further with your issue. However the way you phrased your question it sounds like you're generally on the wrong track.

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 rd1349 · Oct 08, 2018 at 11:10 AM 0
Share

Thanks for the reply and sorry for the delay. It was a packed weekend. That was what I was afraid of actually, I'll take your word that ExecuteInEdit$$anonymous$$ode was not intended to add editor functionality. Unity has been fighting me every step of the way on this. I'll abandon this method and try some in engine UI ins$$anonymous$$d.

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

158 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 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Adventure interactionSystem Structure (ScriptableObject,MonoBehavior,POO?) 0 Answers

Call method of a behaviour from a scripotableobject 0 Answers

How do I decide which Conversation to start when clicking on an NPC? 0 Answers

ScriptableObject not Serializing? 0 Answers

Can't you add tags using a script instead of tagging it through the 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