how to activate a Boolean when Inputfield is not empty ?
I have three different scenes , every scene has three input fields ,and three buttons to load next and previous scene. in my case when three inputfields are filled then only user can move to next scene .. for that i'm using three booleans . But now i want like, if the inputfield is filled by some text than only booleans should activate.but im unable to find the solution, can anybody slove this.
thanks in advance
Answer by Salanyel · Dec 17, 2015 at 03:51 PM
You can have somethink looking like that by applying tags to each of your inputfield. Inside each inputfield, you will have this script with a link to your object with a texture
public GameObject m_myObjectThatShouldDisplayATexture;
public bool m_value;
void Update ()
{
if (gameObject.GetComponentInChildren<Text>().text != "")
{
m_value = true;
}
if (m_value == true)
{
//At the end of the line, put your code to modify your sprite renderer. If it is a sprite renderer
m_myObjectThatShouldDisplayATexture.GetComponent<SpriteRenderer>(); // Set texture OK
}
else
{
//At the end of the line, put your code to modify your sprite renderer. If it is a sprite renderer
m_myObjectThatShouldDisplayATexture.GetComponent<SpriteRenderer>(); //Set texture NOK
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612052834im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I check if bool is true from another script? 2 Answers
complete code in an if-statement even if statement turn false 2 Answers
Convert Message to Text Field Input 0 Answers
multi verification 1 Answer
what is the position type returned by InteractionSourceLocation.TryGetPosition in v2017? 0 Answers