fix Unity deprecation warnings

This commit is contained in:
BlackMATov
2025-03-08 04:04:41 +07:00
parent f945d7dddb
commit e6735fd526
5 changed files with 51 additions and 5 deletions

View File

@@ -71,6 +71,30 @@ namespace FTRuntime.Internal {
return comp;
}
//
// FindObjectOfType<T>
//
public static T FindObjectOfType<T>() where T : Object {
#if UNITY_2021_3_OR_NEWER
return Object.FindAnyObjectByType<T>();
#else
return Object.FindObjectOfType<T>();
#endif
}
//
// FindObjectsOfType<T>
//
public static T[] FindObjectsOfType<T>() where T : Object {
#if UNITY_2021_3_OR_NEWER
return Object.FindObjectsByType<T>(FindObjectsSortMode.None);
#else
return Object.FindObjectsOfType<T>();
#endif
}
//
// FillGeneratedMesh
//