- Home /
How do i set screenshot image of Scene2 to Scene1(Button) in unity. Thanks in adavance
After winning the game i want to set my Level-1 screenshot image to Button1 if i get reply i will be very gratefull to you.
Answer by Jam0kid · Sep 11, 2017 at 05:21 AM
Well, assuming you're using Unity's UI system and a canvas, you can set it through code with something along the lines of the following (if you have a script of some kind to cater).
using UnityEngine.UI;
public Sprite scene1Sprite;
//Will require you to throw this line into where you're checking you've finished and set to high-score scene.
public void CalledWhenHitLevelChange()
{
GameObject.Find("Button1").GetComponent<Image>().sprite = scene1Sprite;
}
Basic, of course, and mostly pseudocode. You should check out the documentation. If you have any more questions, don't hesitate to PM me.
Thank You #Jam0kid.i have tried with this kind of code , could not get result . I have i problem that how to get the screenshot and save it.
Your answer
![](https://koobas.hobune.stream/wayback/20220612134617im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Image in Button is cut (New UI) 2 Answers
Best way to capture super large screenshot images (all GPUs) 0 Answers
imaged text button 2 Answers
I have a glitch with my game that makes bullets keep firing when it goes into the next level 0 Answers
how to add image to a button and link it to a another scene 1 Answer