check if object has component unity code example
Example 1: unity check if a gameobject has a component
if(gameObjectToCheck.GetComponent<Rigidbody>() != null) { //do something }
Example 2: unity c# check how many of an object exists
TotalAmount = FindObjectsOfType<Object>().Length;
Example 3: get if object has tag unity
if (NameOfGameObject.tag == "A-Tag") {
// some code
}