get float from others script

Code Example - get float from others script

                
                        var class1 = GameObject.Find("MyObjectScript").GetComponent<MyClass1>();
    class1.myfloat = 3;
                    
                
 

unity float from another script

                        
                                public GameObject ScriptHolder;
public float Afloat;

//retrieve float every frame
void Update()
{
	Afloat = ScriptHolder.GetComponent<Script>().WantedFloat;
}
                            
                        
 

Related code examples