Skip to content

Commit 420e1c6

Browse files
committed
use reflection so we can continue to compile w 2017.1
1 parent 3546fd0 commit 420e1c6

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

Assets/FbxExporters/Editor/FbxPrefabAutoUpdater.cs

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections;
22
using System.Collections.Generic;
3+
using System.Reflection;
34
using UnityEngine;
45
using UnityEditor;
56
using System.Linq;
@@ -889,8 +890,6 @@ public HashSet<GameObject> ImplementUpdates(FbxPrefab prefabInstance)
889890
{
890891
Log("{0}: performing updates", prefabInstance.name);
891892

892-
int[] unityVersion = null;
893-
894893
var updatedNodes = new HashSet<GameObject>();
895894

896895
// Gather up all the nodes in the prefab so we can look up
@@ -1019,21 +1018,15 @@ public HashSet<GameObject> ImplementUpdates(FbxPrefab prefabInstance)
10191018
rectTransform.localRotation = tempTransform.localRotation;
10201019
rectTransform.localPosition = tempTransform.localPosition;
10211020
rectTransform.localScale = tempTransform.localScale;
1022-
#region force update of rect transform 2017.3 or newer
1023-
if (unityVersion == null) {
1024-
unityVersion = new int [2];
10251021

1026-
var versionParts = Application.unityVersion.Split ('.');
1027-
1028-
unityVersion [0] = int.Parse (versionParts [0]);
1029-
unityVersion [1] = int.Parse (versionParts [1]);
1030-
}
1031-
Debug.Assert (unityVersion.Length > 1);
1032-
1033-
// force RectTransform to update (2017.3 or newer)
1034-
if (unityVersion [0] > 2017 || unityVersion [0] == 2017 && unityVersion [1] >= 3)
1035-
rectTransform.ForceUpdateRectTransforms ();
1036-
1022+
#region force update of rect transform 2017.3 or newer
1023+
// using reflection so we can continue to compile against versions 2017.1
1024+
// Retrieve the method you are looking for
1025+
System.Reflection.MethodInfo methodInfo =
1026+
rectTransform.GetType().GetMethod("ForceUpdateRectTransforms");
1027+
// Invoke the method on the instance
1028+
if (methodInfo!=null)
1029+
methodInfo.Invoke(rectTransform, null);
10371030
#endregion
10381031
}
10391032
finally

0 commit comments

Comments
 (0)