I have been trying to make a tgc type game. I have scriptable objects with my cards data and one with a list filled with those card scriptable objects. I cant seem to use the list in my code.
ArgumentException: GetComponent requires that the requested component ‘CardDatabase’ derives from MonoBehaviour or Component or is an interface.
UnityEngine.Component.GetComponent[T] () (at <480508088aee40cab70818ff164a29d5>:0)
Test+d__5.MoveNext () (at Assets/Scripts/Test.cs:17)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <480508088aee40cab70818ff164a29d5>:0)
You actually WROTE in your post above that your CardDatabase is a ScriptableObject and actually posted the code above. Why is the above error even remotely mysterious to you? A ScriptableObject is neither a MonoBehavior or a Component, which means you cannot use GetComponent<>()! It is really THAT SIMPLE.
What are you trying to do? Do you just intend to make a public field that you can drag a reference into?
Currently the test script is on a button. I am trying to get it to access the database and randomly pick data to attach the the cards that is being instantiated. At this point I am just using the test button as an object to call out the names of the cards in the list just to see if it is working correctly. I don’t understand how to get access to the items on the list. GetComponent () isn’t working because the cards aren’t components that I understand but what to use instead is what I’m asking.