- Home /
1prefab and and a scriptPool in inspector
Hello,
I am doing a simple game, and I want items to be spawned randomly on the map.
I have a like 10 different script with the item behavior (like weapon and other stuff).
What I would like to do is *
A Manager spawn a prefab on a random point on the map (done)
This prefab will select a random item and display the icon of it (i struggle with the item selection)
When a player walk on the it, he get the script and can actiavate it. (done)
In order to do that, I tried to make a Interface DroppableItem and also tried a parent class, each item is derive from this class or this interface.
The problem is, If I say in the inspector
public DroppableItem[] myItemPool;
I can't add my items to it cause the inspector don't handle interface, and in the case of heritance he accept only the parent class and not the child class.
One solution would be to make like 10 prefabs that looks all the same, but with different scripts, and spawn them directly, but I thought that the previous solution with one prefab and many script is better.
I struggle implementing it tho.