- Home /
Duplicate Question
Populating a list with different items in different clones of the same prefab.
In my game I've got some enemy prefabs. Each turn the player takes there is a chance spawn one of these enemies at random. Now, when the player kills an enemy it instantiates a deadEnemy prefab. Each enemy spawns the same deadEnemy prefab. DeadEnemy is a loot container, when the player stands on it and presses L it populates a lootList in a script attached to the deadEnemy prefab with a random selection of items from a master itemList in another script and shows this lootList in a window. My problem is, if I kill an enemy and then check its lootList, then kill another enemy and check its lootList, they both contain the same items. In fact all new instances of deadEnemy will contain the same lootList.
Is there a way I can make each new instance contain a different random selection? Or is it just that because they all stem from the same prefab, they will contain the same items?
Any help would be appreciated.
Yes, tons of questions about lists but none for lists in prefabs. Thanks for nothing.
Follow this Question
Related Questions
How do I Instantiate a prefab in a list? 0 Answers
Multiple Cars not working 1 Answer
A node in a childnode? 1 Answer
How to make TCG Deck (Instatiate based on Prefab) 1 Answer
Database input datetime 2 Answers