As the title says, I’m developing a card game in which I want the cards to be modelled as ScriptableObjects, and their “card is played” effects as ScriptableObjects too. The problem is that those Effects are polymorphic and each one has it’s own parameters.
I would want the card effects to be displayed in the inspector as either [1] or [2], so that I can dinamically add effects to the list and also configure the effect parameters.
The closest I’ve come is by creating each effect asset with the parameters set, but I want the parameters to be configurable on the card and not on the effects (imagine having to have an effect asset for 1 damage, 2 damage, 3 damage… and so on)
I’m assuming that either I have approached this problem in the wrong way or that I have made a mistake (or many). What should I change and implement to either accomplish [Inspector 1] or [Inspector 2]?
I dont know if this is suited for your example, but I resolved a similar situation by doing this:
I have a singleton manager in the scene, with scriptableobjects items added to a list on this manager.
In a x class inspector, no matter where it was used (scriptableobject in project, gameobject in scene, etc) i have some class variables (let’s say ItemData) with a property drawer, that it have to be used to input a string that is an ID from the same scriptableobject items added to the singleton.
I resolved it by detecting the selected scene object, and if it is the singleton, the drawer for the ItemData shows a dropdown list with the names of the items added to the singleton, and if not the case, it shows the inputfield to enter it by hand.
I take care also of not doing this writtable in runtime, detect when the focus changes in the selected gameobject and some other edge situations.
I hope this gaves you an idea of what to do.