A Vector3 to equal the position of my gameobject?

I get this compiletime error: UnityEngine.Vector3 does not contain a constructor that takes 0 arguments. Here’s the code sample:

Variable Declaration:

private Vector3 position = Vector3.zero;

Inside my Move method:

position = new Vector3(player.transform.position); 

I want to create a Vector3 variable which contains the position of my player object.

The Vector3 constructor expects x, y and z as separate parameters, so you can’t pass an existing Vector3 to it.

Vector3 is a structure, not a class, so it’s passed by value, not by reference. That means that you can simply do the following inside a function (like the Update message method):

playerPosition = player.transform.position;// private Vector3 playerPosition is defined outside the method.

You can’t do this outside of a method.