Skip to content

Commit 27d1807

Browse files
author
Unity Technologies
committed
Unity 2017.2.2p2 C# reference source code
1 parent 19e34f6 commit 27d1807

6 files changed

Lines changed: 46 additions & 4 deletions

File tree

Editor/Mono/EditorGUI.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,14 +663,19 @@ internal static string DoTextField(RecycledTextEditor editor, int id, Rect posit
663663
editor.isPasswordField = passwordField;
664664
editor.DetectFocusChange();
665665
}
666-
else if (s_DragCandidateState == 0)
666+
else if (EditorGUIUtility.editingTextField || (evt.GetTypeForControl(id) == EventType.ExecuteCommand && evt.commandName == "NewKeyboardFocus"))
667667
{
668668
// This one is worse: we are the new keyboardControl, but didn't know about it.
669669
// this means a Tab operation or setting focus from code.
670670
editor.BeginEditing(id, text, position, style, multiline, passwordField);
671671
// If cursor is invisible, it's a selectable label, and we don't want to select all automatically
672672
if (GUI.skin.settings.cursorColor.a > 0)
673673
editor.SelectAll();
674+
675+
if (evt.GetTypeForControl(id) == EventType.ExecuteCommand)
676+
{
677+
evt.Use();
678+
}
674679
}
675680
}
676681

Editor/Mono/Inspector/PlayerSettingsEditor/PlayerSettingsEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1971,7 +1971,7 @@ private ApiCompatibilityLevel[] GetAvailableApiCompatibilityLevels(BuildTargetGr
19711971
if (EditorApplication.scriptingRuntimeVersion == ScriptingRuntimeVersion.Latest)
19721972
return only_4_x_profiles;
19731973

1974-
if (activeBuildTargetGroup == BuildTargetGroup.WSA || activeBuildTargetGroup == BuildTargetGroup.XboxOne)
1974+
if (activeBuildTargetGroup == BuildTargetGroup.WSA)
19751975
return allProfiles;
19761976

19771977
return only_2_0_profiles;

Projects/CSharp/UnityEngine.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@
8484
<Compile Include="..\..\Runtime\Export\UnitySynchronizationContext.cs" >
8585
<Link>Runtime\Export\UnitySynchronizationContext.cs</Link>
8686
</Compile>
87+
<Compile Include="..\..\Runtime\Export\Caching.deprecated.cs" >
88+
<Link>Runtime\Export\Caching.deprecated.cs</Link>
89+
</Compile>
8790
<Compile Include="..\..\Runtime\Export\Random.cs" >
8891
<Link>Runtime\Export\Random.cs</Link>
8992
</Compile>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Unity 2017.2.2p1 C# reference source code
1+
## Unity 2017.2.2p2 C# reference source code
22

33
The C# part of the Unity engine and editor source code.
44
May be used for reference purposes only.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Unity C# reference source
2+
// Copyright (c) Unity Technologies. For terms of use, see
3+
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
4+
5+
using System;
6+
7+
namespace UnityEngine
8+
{
9+
10+
public partial class Caching
11+
{
12+
[System.Obsolete("This function is obsolete. Please use ClearCache. (UnityUpgradable) -> ClearCache()")]
13+
public static bool CleanCache()
14+
{
15+
return ClearCache();
16+
}
17+
}
18+
}

Runtime/UIElements/Managed/IMGUIContainer.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ private GUILayoutUtility.LayoutCache cache
2929
public ContextType contextType { get; set; }
3030
internal int GUIDepth { get; private set; }
3131

32+
int newKeyboardFocusControlID = 0;
3233
internal Matrix4x4 imguiTransform
3334
{
3435
get
@@ -148,7 +149,11 @@ private bool DoOnGUI(Event evt)
148149
}
149150
}
150151

151-
GUIUtility.CheckForTabEvent(evt);
152+
int focusBefore = GUIUtility.keyboardControl;
153+
if (GUIUtility.CheckForTabEvent(evt) && GUIUtility.keyboardControl != focusBefore)
154+
{
155+
newKeyboardFocusControlID = GUIUtility.keyboardControl;
156+
}
152157

153158
// The Event will probably be nuked with the next function call, so we get its type now.
154159
EventType eventType = Event.current.type;
@@ -216,6 +221,17 @@ public override void HandleEvent(EventBase evt)
216221
evt.imguiEvent.type = originalEventType;
217222
ret |= DoOnGUI(evt.imguiEvent);
218223

224+
if (newKeyboardFocusControlID > 0)
225+
{
226+
newKeyboardFocusControlID = 0;
227+
Event focusCommand = new Event();
228+
focusCommand.type = EventType.Layout;
229+
DoOnGUI(focusCommand);
230+
focusCommand.type = EventType.ExecuteCommand;
231+
focusCommand.commandName = "NewKeyboardFocus";
232+
DoOnGUI(focusCommand);
233+
}
234+
219235
if (ret)
220236
{
221237
evt.StopPropagation();

0 commit comments

Comments
 (0)