Hey! I Finally almost finished my menu, but I ran into a problem. I'm trying to change sprite on Popup-list selection change. I haven't found any tutorials, so I made this post. This is my code right now (As you may know from my previous posts, I really suck at coding):
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class Pokemon : MonoBehaviour {
public List<string> Starters;
public string pokeInt;
public UISprite BulbasaurIcon;
// Use this for initialization
void Start () {
Starters.Add("Bulbasaur");
Starters.Add("Charmander");
Starters.Add("Squirtle");
}
// Update is called once per frame
void Update () {
}
public void OnSelectionChange(string mSelectedItem) {
if(Starters.Contains(mSelectedItem)) {
Debug.Log("Changing Starter");
pokeInt = mSelectedItem;
BulbasaurIcon.spriteName = pokeInt;
}
}
}
!!!This isn't completely my code. I just edited the code, I'm using to change Graphic Quality!!!
(and yes, I'm making a pokemon game

)
This code doesn't show any error, but it either doesn't work, or I'm putting it onto wrong object...