mirror of
https://github.com/BlackMATov/unity-flash-tools.git
synced 2025-12-15 04:25:27 +07:00
fix warning on add missing components
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
###### Version 1.3.9
|
||||
* Not save generated meshes in scene
|
||||
* Fix (At line 908 of file "FTMain.jsfl": ReferenceError: ft is not defined)
|
||||
* Fix warning on add missing components
|
||||
|
||||
###### Version 1.3.8
|
||||
* Fix shape groups in tweens problems
|
||||
|
||||
@@ -27,11 +27,12 @@ namespace FTRuntime.Internal {
|
||||
//
|
||||
//
|
||||
|
||||
public static T GetOrCreateComponent<T>(GameObject obj) where T : Component {
|
||||
public static T GetComponent<T>(GameObject obj, bool allow_create) where T : Component {
|
||||
var comp = obj.GetComponent<T>();
|
||||
return comp != null
|
||||
? comp
|
||||
: obj.AddComponent<T>();
|
||||
if ( allow_create && !comp ) {
|
||||
comp = obj.AddComponent<T>();
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
@@ -301,7 +301,7 @@ namespace FTRuntime {
|
||||
/// Update all animation properties (for internal use only)
|
||||
/// </summary>
|
||||
public void Internal_UpdateAllProperties() {
|
||||
ClearCache();
|
||||
ClearCache(false);
|
||||
ChangeTint();
|
||||
ChangeClip();
|
||||
ChangeSequence();
|
||||
@@ -309,11 +309,11 @@ namespace FTRuntime {
|
||||
ChangeSortingProperties();
|
||||
}
|
||||
|
||||
void ClearCache() {
|
||||
_meshFilter = SwfUtils.GetOrCreateComponent<MeshFilter>(gameObject);
|
||||
_meshRenderer = SwfUtils.GetOrCreateComponent<MeshRenderer>(gameObject);
|
||||
void ClearCache(bool allow_to_create_components) {
|
||||
_meshFilter = SwfUtils.GetComponent<MeshFilter> (gameObject, allow_to_create_components);
|
||||
_meshRenderer = SwfUtils.GetComponent<MeshRenderer>(gameObject, allow_to_create_components);
|
||||
#if UNITY_5_6_OR_NEWER
|
||||
_sortingGroup = SwfUtils.GetOrCreateComponent<SortingGroup>(gameObject);
|
||||
_sortingGroup = SwfUtils.GetComponent<SortingGroup>(gameObject, allow_to_create_components);
|
||||
#endif
|
||||
_dirtyMesh = true;
|
||||
_curSequence = null;
|
||||
@@ -432,11 +432,9 @@ namespace FTRuntime {
|
||||
//
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
void Awake() {
|
||||
Internal_UpdateAllProperties();
|
||||
}
|
||||
|
||||
void Start() {
|
||||
ClearCache(true);
|
||||
Internal_UpdateAllProperties();
|
||||
EmitChangeEvents(true, true, true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user