How to load different sprites on a panel based on player level

Hey all
I cant post any code here because i don’t know where to start. What i have so far is the xp and level logic set on a script so that the player will level up when reaching certain xp totals. All of that works perfectly. I also have a panel that loads up on button click. What im trying to do is to make the image different on the panel depending on the player level. So for example if player is level 1 and presses the “store” button it will load image 1 as the panel sprite (its a 2d game), then if the player is level 2 and presses the same button it will load image 2. Ive tried using arrays but dont know how to tie it to player level. Im not sure if i need to make a button manager script, how to get access to the player level on the player level script or really what the best direction is. Ive watched alot of tutorials and none of them show me what im trying to do. Happy to provide more information or anything you need to assist. I hope my objective is clear here. Thanks in advance to all. :smiley:

I think the best solution here would be to make a public array or serialized field private array of playerLevImages[numberOfPlayerLevels], this should be on a script on the panel that you will be changing. Place the images via the editor and the code should look something like:

int level = playerLevel;
image = playerLevelImage;
public image[] playerLevImages = new image[5]; //put quantity of levels
playerLevelImage = playerLevImages[level - 1];
this.image = playerLevelImage;