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 kortemey · Jun 13, 2018 at 07:52 PM · objectbugserializationscriptableobject

Weird Custom Editor bug

Hello,

We are encountering a problem when attempting to use a [System.Serializable] ScriptableObject called NodeData. One of its public member variables is of type UnityEngine.Object. We use this type so we can drag a wide variety of different things into this field in the Inspector. This has been working great for dragging Prefabs, Images, AudioClips etc. into that field.

Our problems began when we started attempting to drag a different type of ScriptableObject (completely unrelated to NodeData) into the field. Though this initially worked fine (ScriptableObject descends from UnityEngine.Object), this has caused a bunch of strange issues later.

  1. Upon restarting Unity Editor and selecting the NodeData ScriptableObject we edited, that Object field looks like this:

There are weird parentheses for some reason. alt text 2. Upon entering play mode, this goes away and is replaced by how the field should look: alt text 3. Though the game works as expected in the Editor, on any built version, that field is interpreted as being null, even though it is definitely filled in the Editor.

Our hypothesis is that Unity is not properly serializing the Object field when we drag a ScriptableObject into it. We are using Unity 2017.3.1f1.

We can work around this issue by using a Prefab instead of a ScriptableObject, but this would require a bunch of refactoring. Does anyone have any ideas?

Thanks!

screenshot-12.png (23.7 kB)
screenshot-13.png (31.5 kB)
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 kortemey · Jun 13, 2018 at 11:22 PM

Found the issue. This comes from having the ScriptableObject filename not the same as its name. I am not sure why this would cause this particular issue. Any insight would be appreciated.

Comment
Add comment · Show 2 · 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 Bunny83 · Jun 13, 2018 at 11:46 PM 1
Share

Well, an asset has an asset ID (basically a GUID). This GUID is stored in the ".meta" file next to the actual assetfile. So the file is actually linked to the specific assetID. Serialized asset references just store that asset id. A ScriptableObject (or $$anonymous$$onoBehaviour which is essentially the same on the native side) instance also has a link to the script asset where the class is defined. This is the assetID of the script file. Unity can't find the actual class when resolving the class name for the instance. $$anonymous$$onoBehaviours usually break totally when the file name doesn'T match the conntained class.

avatar image kortemey · Jun 13, 2018 at 11:49 PM 0
Share

That makes sense. Thank you very much!

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

101 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

Related Questions

Saving UnityEngine.Object into ScriptableObject 1 Answer

Scriptable Object List values are always null 1 Answer

A scripted Object has a different layout when loading: scriptable objects and inheritance 1 Answer

Scriptable object keeps referencing the objects? 1 Answer

Load ScriptableObject / asset file and save as object to list 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