- Home /
Image popup when score reaches 10 C#
Hello, I am beginner.
My game for Android is nearly complete just need to add one more stuff to it. My Question is:
When my player reaches score 10, an Image will appear with a sound, and it will ask the user whether to continue the game or not, and if the player chooses continue then the game will resume, that's it. I am stuck at this. Please help me solve the problem. Below is the score code. The score is working fine, but I don't know how to popup an Image and make a sound play. Thanks in advance
void OnTriggerEnter2D(Collider2D coll) {
//if player collides with score trigger we will increment score
if (coll.name.Contains ("Score")) {
if (IncreaseScore != null)
IncreaseScore (null, null);//to fire the score increment event,uicontroller will uses this event
coll.name = "USED"; //to avoid repeated trigger enter events
//if(IncreaseScore > 10)
//{
//GUI.Texture();
//}
}
Answer by Johnz1234 · Jun 06, 2015 at 05:32 AM
public GameObject PopUpWindow; if( IncreaseScore
now just create GameObject with yout button resume and add this script to the button
public GameObject PopUpWindow; void OnPointerClick(){ Resume(); public void Resume(){ Time.timeScale = 1; PopUpWindow.SetActive(false); }
@Johnz1234 thank you for your answer. I will try your method, but how to store the image and sound into that window?
Your answer
Follow this Question
Related Questions
Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer
GUI 2D Bounding Box 1 Answer
Erroe when resizing GUITextures in C# file 1 Answer
GUI Transparency Changing automatically 2 Answers
GUI Text Score counter 3 Answers