I’ve got an array of different scripts that represent a player’s cards. I’d like to instantiate a card template prefab, and attach the script at the top of the players “deck” (list of monobehaviors) so that the template takes the appearance and effects of that individual card script.
The issue I’m running into is that addComponent<>() seems to only take a type, rather than being able to come from an array, so DrawnCard.addComponent<>(PlayerDeckScripts[0])
doesn’t work. I tried DrawnCard.addComponent<PlayerDeckScripts[0].GetType()
but that doesn’t work either. Any ideas?
Thanks