what command do i use to dynamically move a rect?

i want to be able to have a "rect" follow an object on the screen. i already have the code to make text follow the object. i just can't figure out how to dynamically move the "rect".

Look at rect as a GameComponent.

A property of a GameComponent is that is has a transform.

To edit this transform , means to move the object.

You can do so with the Move method (Character Controller required) Editing the transform member position (Directly x,y,z, in JS or reconstruct the Vector3 in C#) Using a physical force with the physics engine (Requires a rigidbody)

With the question general as it is for now I know little other options, but perhaps you can make it the child of the object you wish it to follow , rather mimic transform changes. It will do so for position aswell as rotation etc.

If you are thinking of GUI and not a sceneobject as Proclyon is mentioning, it's fairly easy.

 Vector3 objectToFollowScreenPos= Camera.main.WorldToScreenPosition(objectYouWantToFollow.transform.position);
    Rect rect = new Rect(objectToFollowScreenPos.x - (widthYouWant * 0.5f),     Camera.main.pixelheight - objectToFollowScreenPos.y - (heightYouWant * 0.5f), widthYouWant, heightYouWant);