Hi. I’m working on a basic 2D platform game like Deadcells. After you beat the boss i want to display a buff selection window which is contains 3 random buffs. Player will choose one of them. These 3 buffs will be chosen randomly among 10 buffs. What is the best way to do this kind of system? Two methods came to my mind.
- Buttons on a panel and somehow
- Use Random.Range with list and
select random sprites
Is there any other logical solution? Thanks.
Example Pic. (10/10 paint ability):
First you must create the “buffs”, you can use Scriptable Objects to store the data of each buff.
[CreateAssetMenu(fileName = "Buff", menuName = "Buffs/Buff", order = 0)]
public class Buff : ScriptableObject
public Sprite icon;
public String description;
And then with right click in project window you can create a Buff. Let’s createsomething like 10 buffs.
For the ui : Each tile needs to have a image component and a button. and attach a script with a reference to the button and image :
public class Slot : MonoBehaviour
public Image img;
private void Awake()
btn = GetComponent<Button>();
Make also a setup method in same script :
public void Setup(Buff buff)
slotBuff = buff
img.sprite = buff.icon;
public void PurchasePlant()
//Stuff to do when the tile is clicked
Make a prefab of the tile with the script and the components attached and then delete the tiles in you hierarchy.
In an empty game object attach a script who will instantiate the tiles and contains the list of the buffs.
public class BuildManager : MonoBehaviour
public Buff  listBuff; //in inspedctor set the 10 buffs created earlier
public GameObject Slot //In inspector set the prefab here
public Transform slotsContent //In inspector set the parent transform of the tiles
public int numberOfTiles;
private void Start()
for (int i = 0; i < numberOfTiles; i++)
GameObject slot = Instantiate(slot, slotsContent.position, Quaternion.identity);
Hope it can help you, may contain some bug code beceause it’s untested but should work
What is your problem? I can not find a problem were we can help you?