-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Precompile Statements to Prevent Warnings in Unity 2023 (#11790)
- Loading branch information
1 parent
e6a567b
commit c4d2873
Showing
28 changed files
with
138 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
{ | ||
"name": "Microsoft.MixedReality.Toolkit.Async", | ||
"rootNamespace": "", | ||
"references": [], | ||
"optionalUnityReferences": [], | ||
"includePlatforms": [], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": false, | ||
"precompiledReferences": [], | ||
"autoReferenced": true, | ||
"defineConstraints": [] | ||
"defineConstraints": [], | ||
"versionDefines": [ | ||
{ | ||
"name": "Unity", | ||
"expression": "2021.3.18", | ||
"define": "UNITY_2021_3_18_OR_NEWER" | ||
} | ||
], | ||
"noEngineReferences": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using UnityEngine; | ||
using System; | ||
|
||
namespace Microsoft.MixedReality.Toolkit.Utilities | ||
{ | ||
/// <summary> | ||
/// A static utility used to avoid deprecated Find Object functions in favor of replacements introduced in Unity >= 2021.3.18. | ||
/// </summary> | ||
public static class FindObjectUtility | ||
{ | ||
/// <summary> | ||
/// Returns the first object matching the specified type. | ||
/// </summary> | ||
/// <remarks> | ||
/// If Unity >= 2021.3.18, calls FindFirstObjectByType. Otherwise calls FindObjectOfType. | ||
/// </remarks> | ||
/// <param name="includeInactive">If true, inactive objects will be included in the search. False by default.</param> | ||
public static T FindObjectByType<T>(bool includeInactive = false) where T : Component | ||
{ | ||
#if UNITY_2021_3_18_OR_NEWER | ||
return UnityEngine.Object.FindFirstObjectByType<T>(includeInactive ? FindObjectsInactive.Include : FindObjectsInactive.Exclude); | ||
#else | ||
return UnityEngine.Object.FindObjectOfType<T>(includeInactive); | ||
#endif | ||
} | ||
|
||
/// <summary> | ||
/// Returns all objects matching the specified type. | ||
/// </summary> | ||
/// <remarks> | ||
/// If Unity >= 2021.3.18, calls FindObjectsByType. Otherwise calls FindObjectsOfType. | ||
/// </remarks> | ||
/// <param name="includeInactive">If true, inactive objects will be included in the search. False by default.</param> | ||
/// <param name="sort">If false, results will not sorted by InstanceID. True by default.</param> | ||
public static T[] FindObjectsByType<T>(bool includeInactive = false, bool sort = true) where T : Component | ||
{ | ||
#if UNITY_2021_3_18_OR_NEWER | ||
return UnityEngine.Object.FindObjectsByType<T>(includeInactive ? FindObjectsInactive.Include : FindObjectsInactive.Exclude, sort ? FindObjectsSortMode.InstanceID : FindObjectsSortMode.None); | ||
#else | ||
return UnityEngine.Object.FindObjectsOfType<T>(includeInactive); | ||
#endif | ||
} | ||
|
||
/// <summary> | ||
/// Returns all objects matching the specified type. | ||
/// </summary> | ||
/// <remarks> | ||
/// If Unity >= 2021.3.18, calls FindObjectsByType. Otherwise calls FindObjectsOfType. | ||
/// </remarks> | ||
/// <param name="includeInactive">If true, inactive objects will be included in the search. False by default.</param> | ||
/// <param name="sort">If false, results will not sorted by InstanceID. True by default.</param> | ||
/// <param name="type">The type to search for.</param> | ||
public static UnityEngine.Object[] FindObjectsByType(Type type, bool includeInactive = false, bool sort = true) | ||
{ | ||
#if UNITY_2021_3_18_OR_NEWER | ||
return UnityEngine.Object.FindObjectsByType(type, includeInactive ? FindObjectsInactive.Include : FindObjectsInactive.Exclude, sort ? FindObjectsSortMode.InstanceID : FindObjectsSortMode.None); | ||
#else | ||
return UnityEngine.Object.FindObjectsOfType(type, includeInactive); | ||
#endif | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.