- Home /
Disable Anchor Presets on Driven RectTransform?
I'm using DrivenRectTransformTracker in a script to drive the min/max anchors of the RectTransform to which the script's attached, and I haven't found a way to disable the anchor presets in the RectTransform's inspector. I've tried these combinations of DrivenTransformProperties, among others:
rectTracker.Add(this, rectTransform, DrivenTransformProperties.Anchors);
rectTracker.Add(this, rectTransform, DrivenTransformProperties.All);
rectTracker.Add(this, rectTransform, DrivenTransformProperties.AnchorMaxX | DrivenTransformProperties.AnchorMaxY | DrivenTransformProperties.AnchorMinX | DrivenTransformProperties.AnchorMinY);
I'm able to disable the Min/Max float fields with these, but that doesn't seem to be of any use if the presets are still active ... Also I've just noticed I can still click and drag the anchor gizmos in the scene view, too. I don't see the point of driving anchors by a script if they can still be modified in the editor. Hopefully I'm missing something. Does anyone know of a way to completely lock the anchors for a RectTransform, sort of like Canvas components do (I don't want all the properties driven, though. Just the anchors)?
Thanks!
Your answer
![](https://koobas.hobune.stream/wayback/20220612113622im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
UI changing position on instantiation on iOS 1 Answer
Positioning UI object inside screen space 0 Answers
RectTransform Anchor gizmos, not visible in scene editor 14 Answers
this code doesnt work when the buttons anchor are not same(custom anchor) 0 Answers
How to move Anchors of a Gameobject to the corners from a script? 0 Answers