unity float from another script

Code Example - unity float from another script

                
                        public GameObject ScriptHolder;
public float Afloat;

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

get float from others script

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

Related code examples