Merge branch 'dev'

This commit is contained in:
BlackMATov
2025-03-08 04:18:57 +07:00
6 changed files with 57 additions and 5 deletions

View File

@@ -1,3 +1,9 @@
### Version 1.4.1
* Fix camera settings for the builtin deferred rendering
* Fix Unity deprecation warnings
### Version 1.4.0
* It's free and Open Source now!

View File

@@ -98,7 +98,7 @@ namespace FTEditor.Editors {
void OnEnable() {
_manager = target as SwfManager;
_controllers = FindObjectsOfType<SwfClipController>().ToList();
_controllers = SwfEditorUtils.FindObjectsOfType<SwfClipController>().ToList();
}
public override void OnInspectorGUI() {

View File

@@ -507,7 +507,7 @@ namespace FTEditor.Postprocessors {
static void UpdateAssetClips(SwfAsset 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)
.ToList();
for ( var i = 0; i < scene_clips.Count; ++i ) {

View File

@@ -15,6 +15,28 @@ using FTRuntime;
namespace FTEditor {
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

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
//

View File

@@ -32,7 +32,7 @@ namespace FTRuntime {
/// <param name="allow_create">If set to <c>true</c> allow create</param>
public static SwfManager GetInstance(bool allow_create) {
if ( !_instance ) {
_instance = FindObjectOfType<SwfManager>();
_instance = SwfUtils.FindObjectOfType<SwfManager>();
if ( allow_create && !_instance ) {
var go = new GameObject("[SwfManager]");
_instance = go.AddComponent<SwfManager>();
@@ -238,7 +238,7 @@ namespace FTRuntime {
}
void GrabEnabledClips() {
var clips = FindObjectsOfType<SwfClip>();
var clips = SwfUtils.FindObjectsOfType<SwfClip>();
for ( int i = 0, e = clips.Length; i < e; ++i ) {
var clip = clips[i];
if ( clip.enabled ) {
@@ -248,7 +248,7 @@ namespace FTRuntime {
}
void GrabEnabledControllers() {
var controllers = FindObjectsOfType<SwfClipController>();
var controllers = SwfUtils.FindObjectsOfType<SwfClipController>();
for ( int i = 0, e = controllers.Length; i < e; ++i ) {
var controller = controllers[i];
if ( controller.enabled ) {