mirror of
https://github.com/BlackMATov/unity-flash-tools.git
synced 2025-12-13 03:30:14 +07:00
fix Unity deprecation warnings
This commit is contained in:
@@ -98,7 +98,7 @@ namespace FTEditor.Editors {
|
|||||||
|
|
||||||
void OnEnable() {
|
void OnEnable() {
|
||||||
_manager = target as SwfManager;
|
_manager = target as SwfManager;
|
||||||
_controllers = FindObjectsOfType<SwfClipController>().ToList();
|
_controllers = SwfEditorUtils.FindObjectsOfType<SwfClipController>().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnInspectorGUI() {
|
public override void OnInspectorGUI() {
|
||||||
|
|||||||
@@ -507,7 +507,7 @@ namespace FTEditor.Postprocessors {
|
|||||||
|
|
||||||
static void UpdateAssetClips(SwfAsset asset) {
|
static void UpdateAssetClips(SwfAsset asset) {
|
||||||
var asset_guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(asset));
|
var asset_guid = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(asset));
|
||||||
var scene_clips = GameObject.FindObjectsOfType<SwfClip>()
|
var scene_clips = SwfEditorUtils.FindObjectsOfType<SwfClip>()
|
||||||
.Where (p => p && p.clip && p.clip.AssetGUID == asset_guid)
|
.Where (p => p && p.clip && p.clip.AssetGUID == asset_guid)
|
||||||
.ToList();
|
.ToList();
|
||||||
for ( var i = 0; i < scene_clips.Count; ++i ) {
|
for ( var i = 0; i < scene_clips.Count; ++i ) {
|
||||||
|
|||||||
@@ -15,6 +15,28 @@ using FTRuntime;
|
|||||||
namespace FTEditor {
|
namespace FTEditor {
|
||||||
static class SwfEditorUtils {
|
static class SwfEditorUtils {
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Compatibility
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
|
public static T FindObjectOfType<T>() where T : Object {
|
||||||
|
#if UNITY_2021_3_OR_NEWER
|
||||||
|
return Object.FindAnyObjectByType<T>();
|
||||||
|
#else
|
||||||
|
return Object.FindObjectOfType<T>();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// Packing
|
// Packing
|
||||||
|
|||||||
@@ -71,6 +71,30 @@ namespace FTRuntime.Internal {
|
|||||||
return comp;
|
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
|
// FillGeneratedMesh
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace FTRuntime {
|
|||||||
/// <param name="allow_create">If set to <c>true</c> allow create</param>
|
/// <param name="allow_create">If set to <c>true</c> allow create</param>
|
||||||
public static SwfManager GetInstance(bool allow_create) {
|
public static SwfManager GetInstance(bool allow_create) {
|
||||||
if ( !_instance ) {
|
if ( !_instance ) {
|
||||||
_instance = FindObjectOfType<SwfManager>();
|
_instance = SwfUtils.FindObjectOfType<SwfManager>();
|
||||||
if ( allow_create && !_instance ) {
|
if ( allow_create && !_instance ) {
|
||||||
var go = new GameObject("[SwfManager]");
|
var go = new GameObject("[SwfManager]");
|
||||||
_instance = go.AddComponent<SwfManager>();
|
_instance = go.AddComponent<SwfManager>();
|
||||||
@@ -238,7 +238,7 @@ namespace FTRuntime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GrabEnabledClips() {
|
void GrabEnabledClips() {
|
||||||
var clips = FindObjectsOfType<SwfClip>();
|
var clips = SwfUtils.FindObjectsOfType<SwfClip>();
|
||||||
for ( int i = 0, e = clips.Length; i < e; ++i ) {
|
for ( int i = 0, e = clips.Length; i < e; ++i ) {
|
||||||
var clip = clips[i];
|
var clip = clips[i];
|
||||||
if ( clip.enabled ) {
|
if ( clip.enabled ) {
|
||||||
@@ -248,7 +248,7 @@ namespace FTRuntime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GrabEnabledControllers() {
|
void GrabEnabledControllers() {
|
||||||
var controllers = FindObjectsOfType<SwfClipController>();
|
var controllers = SwfUtils.FindObjectsOfType<SwfClipController>();
|
||||||
for ( int i = 0, e = controllers.Length; i < e; ++i ) {
|
for ( int i = 0, e = controllers.Length; i < e; ++i ) {
|
||||||
var controller = controllers[i];
|
var controller = controllers[i];
|
||||||
if ( controller.enabled ) {
|
if ( controller.enabled ) {
|
||||||
|
|||||||
Reference in New Issue
Block a user