unity float from another script
public GameObject ScriptHolder;
public float Afloat;
//retrieve float every frame
void Update()
{
Afloat = ScriptHolder.GetComponent<Script>().WantedFloat;
}
unity float from another script
public GameObject ScriptHolder;
public float Afloat;
//retrieve float every frame
void Update()
{
Afloat = ScriptHolder.GetComponent<Script>().WantedFloat;
}
unity float from another gameobject
// If your script is monobehaviour:
// You can use
GetComponent<ScriptName>().yourfloat
// if the script is on the same object as your other script.
// Or find the object first with a tag using
GameObject.FindWithTag("yourobject")
// and then do
.GetComponent<ScriptName>().yourfloat
// if your script is not monobehaviour you will have to make a new instance like
yourscript script = new yourscript();
script.yourfloat
// or make your float value static and you can do yourscript.yourfloat without making a new instance.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us