Simple question:
How can I access a gameObjects transform reference?
I am trying to get a gameObject’s transform to be set as a transform variable in order for other methods in my code to work successfully.
I currently have -
void OnTriggerStay(Collider other)
{
if(other.gameObject.tag == "Enemy" && target == null)
{
Debug.Log ("Shooting the enemy");
target = other.gameObject<GetComponent>Transform();
}
And it doesn’t accept that gameObjectTransform() as a valid piece of code.
I’m sure I’m missing something simple/minor, any help would be appreciated.