Unity ScrollViewScope 水平滚动不适用于 EditorGUILayout

Unity ScrollViewScope horizontal scroll not working with EditorGUILayout

我需要使用 EditorGUI.IndentLevelScope,它只适用于像 LabelField、Foldout 这样的 EditorGUILayout,不能像 Label 这样在 GUILayout 中使用。

这是我的代码

                using (var midScroll = new EditorGUILayout.ScrollViewScope(midSPos, true, true))
                {
                    using (new EditorGUI.IndentLevelScope(1))
                    {
                        midSPos = midScroll.scrollPosition;
                        for (int i = 0; i < 50; i++)
                        {
                            EditorGUILayout.LabelField("This is a EditorGUILayout.LabelField. This is a EditorGUILayout.LabelField.", GUI.skin.GetStyle("LinkLabel"));
                        }
                    }
                }

垂直工作但不是水平工作 图片:https://gyazo.com/70382d83222dc7fc2db54c4745836dfc

与 GUILayout.Label 相同的代码都可以 我想念什么

最后我找到了 Label 的解决方案,通过在 GUILayout 的前后添加一个空的 PrefixLabel,滚动现在可以工作了。

HorizontalScope
    EditorGUILayout.PrefixLabel("");
    GUILayout.Label("content");

但是,我的 foldout 仍然存在一些问题,因为我无法向其中添加 Horizo​​ntalScope

InitRow(row row)
{
    if (isShowing = EditorGUILayout.Foldout(isShowing, "Foldout"))
    {
        InitRow(child);
    }
}