Move pivot point in script

I need to be able to change the position of my gameObject’s pivot point in code, but I can’t seem to find a variable for this. Is it possible?

Modifying the pivot requires you to modify the vertices in the mesh. There is an editor script in the Unity Wiki that modifies the pivot:

http://wiki.unity3d.com/index.php?title=SetPivot

Look at the UpdatePivot() function.

It seems like most of the top results for this were overly complicated, what I did was this:

// Center Pivot
private Vector2 expandPivot = new Vector2(0.5f, 0.5f);

//method:
TMP_object.rectTransform.pivot = expandPivot;

So, basically, just get the rect transform and assign a 2d vector to it’s pivot property.
Necro posting because maybe this has changed in the last 8 years.