Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Bug report: Anchor field doesn't update if you select multiple STMs

A topic by Scarlet String Studios created Feb 18, 2021 Views: 152 Replies: 2
Viewing posts 1 to 3
(1 edit)

Good news, this one should be easy because I was able to reproduce it in a demo scene.

1) Create a canvas

2) Add a bunch of STM objects inside (UIDefault shader)

3) Select them all and try to change the Position -> Anchor enum in the editor

Result: Only one of them will change.

Seems to be an issue only with Anchor. The other fields change as expected.

Developer

Ah, I think I know what's causing this. For UI text, I'm using a custom enum dropdown for text anchors since they only care about Top, Middle ,and Bottom, not Left, Right, and Centre. This value must not be being sent to multi-selected STM objects...


Yep went in and got it fixed! I'll make sure to have it pushed when I do the next update. If you feel like hacking in the fix... search SuperTextMesh.cs for the only instance of "(TextAnchor)" and replace that line and the following if statement with this:


int resultEnumValue = EditorGUILayout.IntPopup("Anchor", (int)Mathf.Floor((float)stm.anchor / 3f) * 3, anchorNames, anchorValues);
if(EditorGUI.EndChangeCheck())
{
serializedObject.FindProperty("anchor").enumValueIndex = resultEnumValue;
}

Yep, the hack worked. Thanks!