You are trying to create a MonoBehaviour using the ‘new’ keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all
UnityEngine.MonoBehaviour:.ctor ()
RPG.Abilities.AbilityData:.ctor (UnityEngine.GameObject) (at Assets/Scripts/Abilities/AbilityData.cs:13)
RPG.Abilities.Ability:Use (UnityEngine.GameObject) (at Assets/Scripts/Abilities/Ability.cs:22)
RPG.Attributes.ActionStore:Use (int,UnityEngine.GameObject) (at Assets/Scripts/Attributes/ActionStore.cs:61)
RPG.Control.PlayerController:UseAbilities () (at Assets/Scripts/Control/PlayerController.cs:60)
RPG.Control.PlayerController:Update () (at Assets/Scripts/Control/PlayerController.cs:45)
It appears your AbilityData
class is a MonoBehaviour
. It shouldn’t be. It is just a pure C# class
Yes, it work, thank you, i have missed that during the lesson
It’s an easy thing to miss. Any time you create a script in Unity, they “help” you by giving you a pre-filled script that is (you guessed it) a MonoBehaviour.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.