Skip to content

Commit e8ed485

Browse files
Add hacky test fix to see if CI passes.
1 parent 5068956 commit e8ed485

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Therefore the UITK version of the InputActionAsset Editor is not available on earlier Editor versions either.
33
#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS
44
using System;
5+
using System.Collections.Generic;
56
using System.Linq;
67
using UnityEditor;
78
using UnityEditor.Callbacks;
@@ -270,16 +271,32 @@ private void BuildUI(bool shouldClearRoot = true)
270271

271272
m_StateContainer = new StateContainer(m_State, m_AssetGUID);
272273
m_StateContainer.StateChanged += OnStateChanged;
273-
274-
if (shouldClearRoot)
274+
IEnumerable<VisualElement> children = null;
275+
if (!shouldClearRoot)
275276
{
276-
rootVisualElement.Clear();
277+
children = new List<VisualElement>(rootVisualElement.hierarchy.Children());
277278
}
278279

280+
rootVisualElement.Clear();
281+
279282
if (!rootVisualElement.styleSheets.Contains(InputActionsEditorWindowUtils.theme))
280283
rootVisualElement.styleSheets.Add(InputActionsEditorWindowUtils.theme);
281284
m_View = new InputActionsEditorView(rootVisualElement, m_StateContainer, false, () => Save(isAutoSave: false));
282285
m_StateContainer.Initialize(rootVisualElement.Q("action-editor"));
286+
287+
if (children != null)
288+
{
289+
foreach (var child in children)
290+
{
291+
for (int i = rootVisualElement.hierarchy.childCount - 1; i >= 0; i--)
292+
{
293+
if (rootVisualElement.hierarchy.ElementAt(i).name != child.name)
294+
{
295+
rootVisualElement.hierarchy.Add(child);
296+
}
297+
}
298+
}
299+
}
283300
}
284301

285302
private void OnStateChanged(InputActionsEditorState newState, UIRebuildMode editorRebuildMode)

0 commit comments

Comments
 (0)