Answers for "c# call a bool from another scrip"

C#
1

c# call a bool from another script

//class A
public class ClassA: MonoBehaviour 
{
	public bool isCounting;

	void Start() 
    {
    	isCounting = true;
  	}
}

//class B 
public class ClassB: MonoBehaviour 
{
	public ClassA cA;

	void Update()
    {
    	if(cA.isCounting )
        {
        	//do something
        }
    }
}
Posted by: Guest on July-17-2021

C# Answers by Framework

Browse Popular Code Answers by Language