I have a Public Transform target that is an empty child on my player GameObject. The transform is in the script for my camera. I want the script to check if the target variable is not assigned and if it’s not I want to assign the target object to the variable.
I tried:
public Transform target;
void Update () {
if (target == null)
{
target = GameObject.FindGameObjectWithTag("PlayerTarget").transform;
}
}