[SOLVED] How do I set a GameObject's position to a static value?

Hey guys. I want to be able to control a GameObject’s position with my players current facing direction. I already have the code for getting the current facing direction. The GameObject is attached to player already.

The thing is, when I set its position via gameObject.transform.position, it starts moving indefinitely. I just want the position to be set to the value it receives.

For example, when I’m moving up, VerticalDirection value becomes 1. I give this value it to the DirectionArrow using this code in the Update function:

gameObject.transform.position = new Vector3(HorizontalDirection, VerticalDirection);

The arrow moves like the character. How do I make it move to the point and make it stay there?

Sorry for my English, tried my best to explain what I want to do.

Edit: My bad, using rotation was what I actually needed to do.

The code you’ve shown does explicitly set the object’s position. You’ll need to share more code / what else could be manipulating the position.

Why is it attached to the player if you don’t want it to move where the player moves?

I solved it. I used rotation.