Yep, just like that - assign a variable to the transforms and use those to access them. Essentially it's storing a direct reference to the transform component. Otherwise it has to look up the transform component every time you use myGameObject.transform.position. Instead you'd use myGameObjectTransform.position and it's…
So, as I understand it, the clicker is the red box? If so, where is it's position getting updated for you to take the distance from it to the player? Also, you're referencing transform.position and transform.rotation in that code... which is going to give you the transform of the GameObject that this script is applied to.…
I think what Farfarer means is that you should make a variable that contains your target. Then you can just assign it once and then it doesn't have to look up what the transform is every frame.myTarget = this.transform or something like that.
apologies, didn't know about code tags, wondered how people got it to display like that. Thanks for your help. My code is nowfloat distance = (clicker.transform.position - active_player.transform.position).magnitude; and it appears to be working now. however, I fixed the flipping problem by changing the code for rotation…