unity get float from another script code example
Example 1: unity float from another script
public GameObject ScriptHolder;
public float Afloat;
//retrieve float every frame
void Update()
{
Afloat = ScriptHolder.GetComponent<Script>().WantedFloat;
}
Example 2: get float from others script
var class1 = GameObject.Find("MyObjectScript").GetComponent<MyClass1>();
class1.myfloat = 3;