i have used an image on my game how can i pop up a new image when the first image is clicked

instead of buttons i have used images…when one image is clicked a new one should popup, can any one provide some refferences

Is there any particular reason you can’t use a button. By default you can assign an image to a button.

Here’s a little script I have made that will change the image (you will need to assign ‘image’ in the inspector).

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class ChangeImage : MonoBehaviour {
	public Sprite image;
	Image imageComponent;
	// Use this for initialization
	void Start () {
		imageComponent = gameObject.GetComponent<Image> ();
	}

	public void Change()
	{
		imageComponent.sprite = image;
	}
}

You will need to call ‘Change()’ on the button. So in the OnClick() section choose the object on the left and ChangeImage > Change() on the right.

Hope this helps :slight_smile: