- Home /
How can i change the scriptable object variable in child script (if it's possible)
I have a list inventory of type Pickable which is a child scriptable object of scriptable object Item. Pickable assigned to a script PickableItem which contains functions for every item i can pick up (add to inventory), but it also is a child of script ItemItem which contains functions for items you can't pick up. And the ItemItem script has scriptable object Item assigned (i hope you get the logic). The thing is that the public variable that contains scriptable object is defined in ItemItem, so the PickableItem inherits it. And when from PickableItem i try to access variables in Pickable, Unity says that "Item does not contain definition" for that. I also need variables in the Item so i can't just separate Pickable from Item. Is there any way i can "override" the variable in child script (PickableItem), or something and is it possible and i need to do it another way. I'm sorry if this a stupid question, i'm not experienced in Unity (and in programming), also i'm very sorry if there are mistakes in my question.
I got lost after the third Pickable, could you share the sample code?