我正在创建自定义布局组并希望控制子对象上的RectTransform。我想锁定子RectTransform的某些字段,类似于在使用画布或Unity的水平或垂直组时无法修改。
任何其他想法?
我需要相同的效果。您可以在子RectTransform的顶部看到此消息:Some values driven by HorizontalLayoutGroup
我发现了一种折中方法:
添加[ExecuteInEditMode]然后:
public void Update()
{
#if UNITY_EDITOR
if (!Application.isPlaying)
{
/* Todo => update child's positions here. */
}
#endif
}
任何其他想法?
HorizontalLayoutGroup
时,由于它是由布局组驱动的,因此我们无法更改子元素的位置,而且编辑器的GUI字段被锁定,用户无法更改。我需要相同的效果。您可以在子RectTransform的顶部看到此消息:Some values driven by HorizontalLayoutGroup
。 - High