Is it possible to make this conditional? I want to design game items such that an item parent script has an array of item data subtypes (for example, weapon data, or consumable data). I want to set it up so, if I add an item subtype to the array, it will automatically add the appropriate script to the object rather than having to remember to manually add the script.
So, let’s say I am creating a chocolate sword object. I add the item parent script to it. In the inspector, I set the item subtype array to 2 elements and add ‘weapon’ and ‘consumable’ as those subtypes. Ideally, I would like, then, for the weaponData and consumableData scripts to be automatically added to the object by dong this. This seems like RequireComponent functionality, but I’m not sure you can even do conditional checking using that. Is there anyway to achieve this sort of functionality, or am I just going to have to remember to add the scripts myself?