Skip to content

Commit 66f49e5

Browse files
committed
Fix for Unity 6 changes, updated version to 2.4.5
1 parent d598678 commit 66f49e5

File tree

7 files changed

+45
-10
lines changed

7 files changed

+45
-10
lines changed

Assets/UXF/Examples/3_MultiScene_FootballAndRT/Scripts/Example_MultiSceneExperimentGenerator.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,19 @@ void SceneSpecificSetup(Trial trial)
7777
// there are lots of ways to do this, but this works fine here
7878
if (trial.block.number == 1)
7979
{
80+
#if UNITY_6000
81+
FindFirstObjectByType<Example_ShootingTask>().StartShootingTaskTrial(trial);
82+
#else
8083
FindObjectOfType<Example_ShootingTask>().StartShootingTaskTrial(trial);
84+
#endif
8185
}
8286
else if (trial.block.number == 2)
8387
{
88+
#if UNITY_6000
89+
FindFirstObjectByType<Example_ReactionTask>().StartReactionTaskTrial(trial);
90+
#else
8491
FindObjectOfType<Example_ReactionTask>().StartReactionTaskTrial(trial);
92+
#endif
8593
}
8694
}
8795

@@ -94,11 +102,19 @@ public void CleanupTrial(Trial trial)
94102
// there are lots of ways to do this, but this works fine here
95103
if (trial.block.number == 1)
96104
{
105+
#if UNITY_6000
106+
FindFirstObjectByType<Example_ShootingTask>().EndShootingTaskTrial(trial);
107+
#else
97108
FindObjectOfType<Example_ShootingTask>().EndShootingTaskTrial(trial);
109+
#endif
98110
}
99111
else if (trial.block.number == 2)
100112
{
113+
#if UNITY_6000
114+
FindFirstObjectByType<Example_ReactionTask>().EndReactionTaskTrial(trial);
115+
#else
101116
FindObjectOfType<Example_ReactionTask>().EndReactionTaskTrial(trial);
117+
#endif
102118
}
103119
}
104120

@@ -157,4 +173,4 @@ void AddScenesToBuildIndex()
157173
# endif
158174

159175
}
160-
}
176+
}

Assets/UXF/Examples/3_MultiScene_FootballAndRT/Scripts/Example_Shooter.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,11 @@ void Update()
5151
// launch when clicked
5252
if (Input.GetMouseButtonDown(0))
5353
{
54+
#if UNITY_6000
55+
ball.linearVelocity = launchVelocity;
56+
#else
5457
ball.velocity = launchVelocity;
58+
#endif
5559
canShoot = false;
5660

5761
// only have a certain time to score, or its classified as a miss!
@@ -82,4 +86,4 @@ public void Timeout()
8286
}
8387

8488
}
85-
}
89+
}

Assets/UXF/Scripts/DataHandling/WebAWSDynamoDB.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,9 @@ public override bool IsIncompatibleWith(UnityEditor.BuildTargetGroup buildTarget
466466
{
467467
case UnityEditor.BuildTargetGroup.Android:
468468
case UnityEditor.BuildTargetGroup.iOS:
469+
#if !UNITY_2022_2_OR_NEWER
469470
case UnityEditor.BuildTargetGroup.Lumin:
471+
#endif
470472
case UnityEditor.BuildTargetGroup.PS4:
471473
case UnityEditor.BuildTargetGroup.Switch:
472474
case UnityEditor.BuildTargetGroup.tvOS:

Assets/UXF/Scripts/Etc/Editor/UXFSessionDisplay.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,11 @@ static void OnPlayModeStateChanged(PlayModeStateChange state)
4141

4242
static void FetchReferences()
4343
{
44+
#if UNITY_6000
45+
session = FindFirstObjectByType<Session>();
46+
#else
4447
session = FindObjectOfType<Session>();
48+
#endif
4549
if (!session)
4650
{
4751
settingsDict = null;
@@ -206,4 +210,4 @@ static string Truncate(string value, int maxChars)
206210
}
207211
}
208212

209-
}
213+
}

Assets/UXF/Scripts/Etc/Editor/UXFWizard.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
using System.Collections;
2-
using System.IO;
3-
using System.Collections.Generic;
1+
using System.IO;
42
using UnityEngine;
53
using UnityEditor;
4+
using UnityEditor.Build;
65

76
namespace UXF.EditorUtils
87
{
@@ -137,7 +136,13 @@ public void OnGUI()
137136

138137
GUILayout.Label("Compatibility", EditorStyles.boldLabel);
139138

140-
bool compatible = PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.Standalone) == targetApiLevel;
139+
#if UNITY_6000
140+
var standalone = NamedBuildTarget.Android;
141+
#else
142+
var standalone = BuildTargetGroup.Standalone;
143+
#endif
144+
145+
bool compatible = PlayerSettings.GetApiCompatibilityLevel(standalone) == targetApiLevel;
141146

142147
if (compatible)
143148
{
@@ -148,7 +153,7 @@ public void OnGUI()
148153
EditorGUILayout.HelpBox("API Compatibility Level should be set to .NET 2.0 (Older versions of Unity) or .NET 4.x (Unity 2018.3+), expect errors on building", MessageType.Warning);
149154
if (GUILayout.Button("Fix"))
150155
{
151-
PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.Standalone, targetApiLevel);
156+
PlayerSettings.SetApiCompatibilityLevel(standalone, targetApiLevel);
152157
}
153158
}
154159

Assets/UXF/Scripts/EventSystemFallback.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,15 @@ void Start()
2828

2929
void CreateEventSystem()
3030
{
31+
#if UNITY_6000
32+
if (FindFirstObjectByType<EventSystem>() == null)
33+
#else
3134
if (FindObjectOfType<EventSystem>() == null)
35+
#endif
3236
{
3337
var newEventSystem = Instantiate(eventSystemPrefab);
3438
newEventSystem.name = "EventSystem";
3539
}
3640
}
3741
}
38-
}
42+
}

Assets/UXF/VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.4.3
1+
2.4.5

0 commit comments

Comments
 (0)