Setting variable Transform gameObject

I have a camera script that follows the player that I put in the “var target: Transform;”

var target : Transform;

Although I can set the object from the inspector, I do not know how to set the variable dynamically through script. I thought it might work something like -

var target : Player.Transform;

However this does not work… How do I set this variable properly?

There’s nothing wrong with your first example, and ‘target’ would then refer to the Player and you can use it in your scripts. If you are asking how do you assign that without a drag/drop Editor action, try

GameObject target = GameObject.FindGameObjectWithTag("Player");

(assuming Player has “Player” tag)