Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Inspector Error

$
0
0
I have started using **Odin** today. I'm not sure if it is its fault, but I started creating Scriptable Objects in my new project. I did this: public abstract class Ability : ScriptableObject { public string aName = "Ability"; public Sprite aSprite; public AudioClip aSound; public float baseCoolDown = 1f; public abstract void Initialize(GameObject obj); public abstract void TriggerAbility(); } Now, whenever I try to change aSprite, aSound or play the game I get these two errors: UnityException: set_type is not allowed to be called from a ScriptableObject constructor (or instance field initializer), call it in OnEnable instead. Called from ScriptableObject 'ObjectSelector'. See "Script Serialization" page in the Unity Manual for further details. UnityEngine.Event.KeyboardEvent (System.String key) (at C:/buildslave/unity/build/Modules/IMGUI/Event.cs:153) UnityEditor.ObjectSelector..cctor () (at C:/buildslave/unity/build/Editor/Mono/ObjectSelector.cs:78) Rethrow as TypeInitializationException: An exception was thrown by the type initializer for UnityEditor.ObjectSelector set_type is not allowed to be called from a ScriptableObject constructor (or instance field initializer), call it in OnEnable instead. Called from ScriptableObject 'ObjectSelector'. See "Script Serialization" page in the Unity Manual for further details. UnityEditor.ObjectSelector:.cctor() Any ideas what my be the reason?

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>