Skip to content

Commit 2313990

Browse files
author
David Kline
authored
Merge pull request #3498 from Alexees/mrtk_development
Fixed script errors related to upgrade to Unity 2019.1
2 parents ad2cfda + 2ab513b commit 2313990

File tree

4 files changed

+32
-18
lines changed

4 files changed

+32
-18
lines changed

Assets/MixedRealityToolkit.SDK/Features/UX/Scripts/BoundingBox/BoundingBox.cs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ private void DestroyRig()
362362
{
363363
for (var i = 0; i < balls.Count; i++)
364364
{
365-
Destroy(balls[i]);
365+
Destroy(balls[i].gameObject);
366366
}
367367

368368
balls.Clear();
@@ -372,7 +372,7 @@ private void DestroyRig()
372372
{
373373
for (int i = 0; i < links.Count; i++)
374374
{
375-
Destroy(links[i]);
375+
Destroy(links[i].gameObject);
376376
}
377377

378378
links.Clear();
@@ -382,15 +382,15 @@ private void DestroyRig()
382382
{
383383
for (var i = 0; i < corners.Count; i++)
384384
{
385-
Destroy(corners[i]);
385+
Destroy(corners[i].gameObject);
386386
}
387387

388388
corners.Clear();
389389
}
390390

391391
if (rigRoot != null)
392392
{
393-
Destroy(rigRoot);
393+
Destroy(rigRoot.gameObject);
394394
}
395395
}
396396

@@ -496,7 +496,7 @@ private void ScaleByHandle(Vector3 newHandlePosition)
496496
targetObject.transform.localScale = newScale;
497497
}
498498

499-
private Vector3 GetRotationAxis(GameObject handle)
499+
private Vector3 GetRotationAxis(Transform handle)
500500
{
501501
for (int i = 0; i < balls.Count; ++i)
502502
{
@@ -926,10 +926,10 @@ private void ResetHandleVisibility()
926926
SetHiddenHandles();
927927
}
928928

929-
private void ShowOneHandle(GameObject handle)
929+
private void ShowOneHandle(Transform handle)
930930
{
931931
//turn off all balls
932-
if (balls != null)
932+
if (ballRenderers != null)
933933
{
934934
for (int i = 0; i < ballRenderers.Count; ++i)
935935
{
@@ -938,7 +938,7 @@ private void ShowOneHandle(GameObject handle)
938938
}
939939

940940
//turn off all corners
941-
if (corners != null)
941+
if (cornerRenderers != null)
942942
{
943943
for (int i = 0; i < cornerRenderers.Count; ++i)
944944
{
@@ -1043,7 +1043,7 @@ private void UpdateRigHandles()
10431043
}
10441044
}
10451045

1046-
private HandleType GetHandleType(GameObject handle)
1046+
private HandleType GetHandleType(Transform handle)
10471047
{
10481048
for (int i = 0; i < balls.Count; ++i)
10491049
{
@@ -1201,15 +1201,16 @@ public void OnInputDown(InputEventData eventData)
12011201
currentInputSource = eventData.InputSource;
12021202
currentPointer = pointer;
12031203
grabbedHandle = grabbedCollider.gameObject;
1204-
currentHandleType = GetHandleType(grabbedHandle);
1205-
currentRotationAxis = GetRotationAxis(grabbedHandle);
1204+
Transform grabbedHandleTransform = grabbedHandle.transform;
1205+
currentHandleType = GetHandleType(grabbedHandleTransform);
1206+
currentRotationAxis = GetRotationAxis(grabbedHandleTransform);
12061207
currentPointer.TryGetPointingRay(out initialGrabRay);
12071208
initialGrabMag = distance;
12081209
initialGrabbedPosition = grabbedHandle.transform.position;
12091210
initialGrabbedCentroid = targetObject.transform.position;
12101211
initialScale = targetObject.transform.localScale;
12111212
pointer.TryGetPointerPosition(out initialGrabPoint);
1212-
ShowOneHandle(grabbedHandle);
1213+
ShowOneHandle(grabbedHandleTransform);
12131214
initialGazePoint = Vector3.zero;
12141215
}
12151216
}

Assets/MixedRealityToolkit/Utilities/BuildAndDeploy/UwpAppxBuildTools.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ public static async Task<bool> BuildAppxAsync(string productName, bool forceRebu
154154
string nugetPath = Path.Combine(unity, @"Data\PlaybackEngines\MetroSupport\Tools\NuGet.exe");
155155

156156
// Before building, need to run a nuget restore to generate a json.lock file. Failing to do this breaks the build in VS RTM
157+
158+
#if !UNITY_2019_1_OR_NEWER
157159
if (PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA) == ScriptingImplementation.WinRTDotNET)
158160
{
159161
if (!await RestoreNugetPackagesAsync(nugetPath, storePath) ||
@@ -165,6 +167,7 @@ public static async Task<bool> BuildAppxAsync(string productName, bool forceRebu
165167
return IsBuilding = false;
166168
}
167169
}
170+
#endif
168171

169172
// Ensure that the generated .appx version increments by modifying Package.appxmanifest
170173
if (!SetPackageVersion(incrementVersion))

Assets/MixedRealityToolkit/Utilities/BuildAndDeploy/UwpBuildDeployWindow.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ private void UnityBuildGUI()
357357
EditorGUILayout.BeginHorizontal();
358358

359359
// Generate C# Project References for debugging
360+
#if !UNITY_2019_1_OR_NEWER
360361
bool generateReferenceProjects = EditorUserBuildSettings.wsaGenerateReferenceProjects;
361362

362363
var curScriptingBackend = PlayerSettings.GetScriptingBackend(BuildTargetGroup.WSA);
@@ -371,6 +372,7 @@ private void UnityBuildGUI()
371372
}
372373

373374
GUILayout.FlexibleSpace();
375+
#endif
374376

375377
GUI.enabled = ShouldOpenSLNBeEnabled;
376378

@@ -502,7 +504,10 @@ private void AppxBuildGUI()
502504
buildConfigOption = WSABuildType.Debug;
503505
}
504506

507+
#if !UNITY_2019_1_OR_NEWER
505508
EditorUserBuildSettings.GetWSADotNetNative(buildConfigOption);
509+
#endif
510+
506511
buildConfigOption = (WSABuildType)EditorGUILayout.EnumPopup("Build Configuration", buildConfigOption, GUILayout.Width(HalfWidth));
507512

508513
string buildConfigString = buildConfigOption.ToString();
@@ -919,9 +924,9 @@ private void DeployGUI()
919924
GUILayout.EndVertical();
920925
}
921926

922-
#endregion Methods
927+
#endregion Methods
923928

924-
#region Utilities
929+
#region Utilities
925930

926931
private async void ConnectToDevice(DeviceInfo currentConnection)
927932
{
@@ -1231,9 +1236,9 @@ private static string UpdatePackageName()
12311236
return string.Empty;
12321237
}
12331238

1234-
#endregion Utilities
1239+
#endregion Utilities
12351240

1236-
#region Device Portal Commands
1241+
#region Device Portal Commands
12371242

12381243
private static async void OpenDevicePortal(DevicePortalConnections targetDevices, DeviceInfo currentConnection)
12391244
{
@@ -1481,6 +1486,6 @@ private static void OpenLogFilesOnDeviceList(DevicePortalConnections targetDevic
14811486
}
14821487
}
14831488

1484-
#endregion Device Portal Commands
1489+
#endregion Device Portal Commands
14851490
}
14861491
}

Assets/MixedRealityToolkit/Utilities/BuildAndDeploy/UwpPlayerBuildTools.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,14 @@ public static void BuildUwpPlayer(BuildInfo buildInfo)
147147
EditorUserBuildSettings.wsaUWPBuildType = buildInfo.WSAUWPBuildType.Value;
148148
}
149149

150+
#if !UNITY_2019_1_OR_NEWER
150151
var oldWSAGenerateReferenceProjects = EditorUserBuildSettings.wsaGenerateReferenceProjects;
151152

152153
if (buildInfo.WSAGenerateReferenceProjects.HasValue)
153154
{
154155
EditorUserBuildSettings.wsaGenerateReferenceProjects = buildInfo.WSAGenerateReferenceProjects.Value;
155156
}
157+
#endif
156158

157159
var oldColorSpace = PlayerSettings.colorSpace;
158160

@@ -196,17 +198,20 @@ public static void BuildUwpPlayer(BuildInfo buildInfo)
196198
{
197199
OnPostProcessBuild(buildInfo, buildReport);
198200

201+
#if !UNITY_2019_1_OR_NEWER
199202
if (buildInfo.BuildTarget == BuildTarget.WSAPlayer && EditorUserBuildSettings.wsaGenerateReferenceProjects)
200203
{
201204
UwpProjectPostProcess.Execute(buildInfo.OutputDirectory);
202205
}
203206

207+
EditorUserBuildSettings.wsaGenerateReferenceProjects = oldWSAGenerateReferenceProjects;
208+
#endif
209+
204210
PlayerSettings.colorSpace = oldColorSpace;
205211
PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, oldBuildSymbols);
206212

207213
EditorUserBuildSettings.wsaUWPBuildType = oldWSAUWPBuildType.Value;
208214

209-
EditorUserBuildSettings.wsaGenerateReferenceProjects = oldWSAGenerateReferenceProjects;
210215
EditorUserBuildSettings.SwitchActiveBuildTarget(oldBuildTargetGroup, oldBuildTarget);
211216
}
212217
}

0 commit comments

Comments
 (0)