- Home /
Changing something in another scene by answering correctly with GlobalManager
I'm kind of a noob and I'm making a guess the movie game, and I wondered if anybody know how I can make it so. When a person answers correctly, the button with a image on the other scene needs to change. So I need a script that changes puts a image or something over the button on the other scene. This is the script that that i need to put it in------- using UnityEngine; using System.Collections; using UnityEngine.UI; using UnityEngine.SceneManagement;
public class Spawn: MonoBehaviour {
private string gameName;
private int countGuess;
[SerializeField]
private InputField input;
[SerializeField]
private Text text;
void Awake(){
gameName = "spawn";
text.text = "Guess The Name Of The Game";
}
public void GetInput(string guess){
CompareGuesses(guess);
input.text = "";
}
public void CompareGuesses (string guess){
if (guess == gameName) {
text.text = "You Guessed Correctly";
SceneManager.LoadScene("Level 1");
} else if (guess != gameName) {
text.text = "Wrong!";
} else if (guess != gameName) {
text.text = "Wrong!";
}
}
So if I make a image an put the GlobalManager and DontDestroyOnLoad script on it, in the scene that dosn't have the InputField. Then I go to the scene with the InputField, and should be able to find it there. But do I need to do something with the script that is on the InputField(The script that says what happends when a person answers correctly) . or how do i do it so the image becomes visible when the person answers correctly?
Your answer
Follow this Question
Related Questions
DontDestroyOnLoad cancelling when Main Menu is open 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Destroying Dontdestroyonload in code 1 Answer
Change Scene by answering right 3 Answers