Skip to content

Commit 21358fc

Browse files
authored
Merge pull request #3696 from Railboy/mrtk_net_compilation_fix
Minor changes to ensure MRTK compiles with .NET
2 parents af04131 + 41c6d22 commit 21358fc

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

Assets/MixedRealityToolkit/Definitions/Physics/RayStep.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,8 @@ public static Vector3 GetPointByDistance(RayStep[] steps, float distance)
137137
Debug.Assert(steps != null);
138138
Debug.Assert(steps.Length > 0);
139139

140-
var (rayStep, remainingDistance) = GetStepByDistance(steps, distance);
140+
float remainingDistance = 0;
141+
RayStep rayStep = GetStepByDistance(steps, distance, ref remainingDistance);
141142
if (remainingDistance > 0)
142143
{
143144
return Vector3.Lerp(rayStep.Origin, rayStep.Terminus, remainingDistance / rayStep.Length);
@@ -154,7 +155,7 @@ public static Vector3 GetPointByDistance(RayStep[] steps, float distance)
154155
/// <param name="steps"></param>
155156
/// <param name="distance"></param>
156157
/// <returns></returns>
157-
public static (RayStep rayStep, float traveledDistance) GetStepByDistance(RayStep[] steps, float distance)
158+
public static RayStep GetStepByDistance(RayStep[] steps, float distance, ref float traveledDistance)
158159
{
159160
Debug.Assert(steps != null);
160161
Debug.Assert(steps.Length > 0);
@@ -174,11 +175,13 @@ public static (RayStep rayStep, float traveledDistance) GetStepByDistance(RaySte
174175
}
175176
else
176177
{
177-
return (steps[i], remainingDistance);
178+
traveledDistance = remainingDistance;
179+
return steps[i];
178180
}
179181
}
180182

181-
return (steps[steps.Length - 1], remainingDistance);
183+
traveledDistance = remainingDistance;
184+
return steps[steps.Length - 1];
182185
}
183186

184187
/// <summary>
@@ -192,7 +195,8 @@ public static Vector3 GetDirectionByDistance(RayStep[] steps, float distance)
192195
Debug.Assert(steps != null);
193196
Debug.Assert(steps.Length > 0);
194197

195-
return GetStepByDistance(steps, distance).rayStep.Direction;
198+
float traveledDistance = 0;
199+
return GetStepByDistance(steps, distance, ref traveledDistance).Direction;
196200
}
197201

198202
#endregion

Assets/MixedRealityToolkit/Utilities/InspectorFields/InspectorGenericFields.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public static void LoadSettings(T target, List<InspectorPropertySetting> setting
2323
{
2424
Type myType = target.GetType();
2525

26-
PropertyInfo[] propInfoList = myType.GetProperties();
27-
for (int i = 0; i < propInfoList.Length; i++)
26+
List<PropertyInfo> propInfoList = new List<PropertyInfo>(myType.GetProperties());
27+
for (int i = 0; i < propInfoList.Count; i++)
2828
{
2929
PropertyInfo propInfo = propInfoList[i];
3030
var attrs = (InspectorField[])propInfo.GetCustomAttributes(typeof(InspectorField), false);
@@ -35,8 +35,8 @@ public static void LoadSettings(T target, List<InspectorPropertySetting> setting
3535
}
3636
}
3737

38-
FieldInfo[] fieldInfoList = myType.GetFields();
39-
for (int i = 0; i < fieldInfoList.Length; i++)
38+
List<FieldInfo> fieldInfoList = new List<FieldInfo>(myType.GetFields());
39+
for (int i = 0; i < fieldInfoList.Count; i++)
4040
{
4141
FieldInfo fieldInfo = fieldInfoList[i];
4242
var attrs = (InspectorField[])fieldInfo.GetCustomAttributes(typeof(InspectorField), false);
@@ -59,8 +59,8 @@ public static List<InspectorPropertySetting> GetSettings(T source)
5959
Type myType = source.GetType();
6060
List<InspectorPropertySetting> settings = new List<InspectorPropertySetting>();
6161

62-
PropertyInfo[] propInfoList = myType.GetProperties();
63-
for (int i = 0; i < propInfoList.Length; i++)
62+
List<PropertyInfo> propInfoList = new List<PropertyInfo>(myType.GetProperties());
63+
for (int i = 0; i < propInfoList.Count; i++)
6464
{
6565
PropertyInfo propInfo = propInfoList[i];
6666
var attrs = (InspectorField[])propInfo.GetCustomAttributes(typeof(InspectorField), false);
@@ -70,8 +70,8 @@ public static List<InspectorPropertySetting> GetSettings(T source)
7070
}
7171
}
7272

73-
FieldInfo[] fieldInfoList = myType.GetFields();
74-
for (int i = 0; i < fieldInfoList.Length; i++)
73+
List<FieldInfo> fieldInfoList = new List<FieldInfo>(myType.GetFields());
74+
for (int i = 0; i < fieldInfoList.Count; i++)
7575
{
7676
FieldInfo fieldInfo = fieldInfoList[i];
7777
var attrs = (InspectorField[])fieldInfo.GetCustomAttributes(typeof(InspectorField), false);

0 commit comments

Comments
 (0)