How to change UI Image Sprite from a list with UI Buttons to navigate back and forth?
Hey folks!
I'm new to GameDev, and I'm learning as I go, I'm currently making this card gallery game. I want to implement a function where you can click on a card, get it zoomed in a whole different scene with two buttons, next and previous and navigate through the rest of the cards in the same scene.
Any pointers on how to go about this would be much appreciated!
PS: I'm new to C# but I'm starting to know my way around.
if i understood correctly, i don't think you need a different scene. all you need is another panel where it has an image(this image sprite you need to change according to whatever you clicked on the previous menu). for example you have grid of images with all have button componect on it. you script shoul look like
public int fileIndx = 0;
public sprite[] allSprites;
public GameObject previewPanel;
public image displayImg;
// this method you need to link for gallery images...........
public void OnSelectFrameFromGallery(int no){
fileIndx = no;
ShowPreview(0);
previewPanel.setActive(true);
}
public void ShowPreview(int mul){
fileIndx += mul;
displayImg.sprite = allSprites[fileIndx]
}
note for Prev and next buttons link the ShowPreview method but with different parameters(for prev button -1 and next button 1)
Your answer
Follow this Question
Related Questions
UI elements not showing up on World Space Canvas 1 Answer
Card array layout 1 Answer
UI Clicking thought alpha of image 3 Answers
Object reference not set to instance of an object? 1 Answer
Images with mipmaps don't fully display on iPhone 5c 0 Answers