GetComponent

Im trying to get the value of a varible from another script. i dont think i have the syntax right? im using C#

the name of the script the variable is in is called LoginScreen and the name of the variable is called createNewAccount.

i set the variable to public.

is this correct?

if (GetComponent(LoginScreen).createNewAccount == true)

You have any information you need in the script reference. There’s actually 3 correct syntax for the GetComponent methdod :

GetComponent("LoginScreen");  //Should try to avoid
GetComponent(typeof(LoginScreen)); //Better, but still not like it
GetComponent<LoginScreen>() //Fastest one, so best one

Next time though, try to look a bit in the script reference before jumping on Unity Answers and wait for someone else to answer.