Skip to content

Chore: Added Unity 6 support with backward compatibility #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,19 @@ void SceneSpecificSetup(Trial trial)
// there are lots of ways to do this, but this works fine here
if (trial.block.number == 1)
{
#if UNITY_6000
FindFirstObjectByType<Example_ShootingTask>().StartShootingTaskTrial(trial);
#else
FindObjectOfType<Example_ShootingTask>().StartShootingTaskTrial(trial);
#endif
}
else if (trial.block.number == 2)
{
#if UNITY_6000
FindFirstObjectByType<Example_ReactionTask>().StartReactionTaskTrial(trial);
#else
FindObjectOfType<Example_ReactionTask>().StartReactionTaskTrial(trial);
#endif
}
}

Expand All @@ -94,11 +102,19 @@ public void CleanupTrial(Trial trial)
// there are lots of ways to do this, but this works fine here
if (trial.block.number == 1)
{
#if UNITY_6000
FindFirstObjectByType<Example_ShootingTask>().EndShootingTaskTrial(trial);
#else
FindObjectOfType<Example_ShootingTask>().EndShootingTaskTrial(trial);
#endif
}
else if (trial.block.number == 2)
{
#if UNITY_6000
FindFirstObjectByType<Example_ReactionTask>().EndReactionTaskTrial(trial);
#else
FindObjectOfType<Example_ReactionTask>().EndReactionTaskTrial(trial);
#endif
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,11 @@ void Update()
// launch when clicked
if (Input.GetMouseButtonDown(0))
{
#if UNITY_6000
ball.linearVelocity = launchVelocity;
#else
ball.velocity = launchVelocity;
#endif
canShoot = false;

// only have a certain time to score, or its classified as a miss!
Expand Down
2 changes: 2 additions & 0 deletions Assets/UXF/Scripts/DataHandling/WebAWSDynamoDB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,9 @@ public override bool IsIncompatibleWith(UnityEditor.BuildTargetGroup buildTarget
{
case UnityEditor.BuildTargetGroup.Android:
case UnityEditor.BuildTargetGroup.iOS:
#if !UNITY_2022_2_OR_NEWER
case UnityEditor.BuildTargetGroup.Lumin:
#endif
case UnityEditor.BuildTargetGroup.PS4:
case UnityEditor.BuildTargetGroup.Switch:
case UnityEditor.BuildTargetGroup.tvOS:
Expand Down
4 changes: 4 additions & 0 deletions Assets/UXF/Scripts/EventSystemFallback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ void Start()

void CreateEventSystem()
{
#if UNITY_6000
if (FindFirstObjectByType<EventSystem>() == null)
#else
if (FindObjectOfType<EventSystem>() == null)
#endif
{
var newEventSystem = Instantiate(eventSystemPrefab);
newEventSystem.name = "EventSystem";
Expand Down