fix warning on add missing components

This commit is contained in:
2017-08-06 00:34:16 +07:00
parent 2aa7ca4a0a
commit 0d42dd1b12
4 changed files with 14 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
###### Version 1.3.9 ###### Version 1.3.9
* Not save generated meshes in scene * Not save generated meshes in scene
* Fix (At line 908 of file "FTMain.jsfl": ReferenceError: ft is not defined) * Fix (At line 908 of file "FTMain.jsfl": ReferenceError: ft is not defined)
* Fix warning on add missing components
###### Version 1.3.8 ###### Version 1.3.8
* Fix shape groups in tweens problems * Fix shape groups in tweens problems

View File

@@ -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>(); var comp = obj.GetComponent<T>();
return comp != null if ( allow_create && !comp ) {
? comp comp = obj.AddComponent<T>();
: obj.AddComponent<T>(); }
return comp;
} }
// //

View File

@@ -301,7 +301,7 @@ namespace FTRuntime {
/// Update all animation properties (for internal use only) /// Update all animation properties (for internal use only)
/// </summary> /// </summary>
public void Internal_UpdateAllProperties() { public void Internal_UpdateAllProperties() {
ClearCache(); ClearCache(false);
ChangeTint(); ChangeTint();
ChangeClip(); ChangeClip();
ChangeSequence(); ChangeSequence();
@@ -309,11 +309,11 @@ namespace FTRuntime {
ChangeSortingProperties(); ChangeSortingProperties();
} }
void ClearCache() { void ClearCache(bool allow_to_create_components) {
_meshFilter = SwfUtils.GetOrCreateComponent<MeshFilter>(gameObject); _meshFilter = SwfUtils.GetComponent<MeshFilter> (gameObject, allow_to_create_components);
_meshRenderer = SwfUtils.GetOrCreateComponent<MeshRenderer>(gameObject); _meshRenderer = SwfUtils.GetComponent<MeshRenderer>(gameObject, allow_to_create_components);
#if UNITY_5_6_OR_NEWER #if UNITY_5_6_OR_NEWER
_sortingGroup = SwfUtils.GetOrCreateComponent<SortingGroup>(gameObject); _sortingGroup = SwfUtils.GetComponent<SortingGroup>(gameObject, allow_to_create_components);
#endif #endif
_dirtyMesh = true; _dirtyMesh = true;
_curSequence = null; _curSequence = null;
@@ -432,11 +432,9 @@ namespace FTRuntime {
// //
// --------------------------------------------------------------------- // ---------------------------------------------------------------------
void Awake() {
Internal_UpdateAllProperties();
}
void Start() { void Start() {
ClearCache(true);
Internal_UpdateAllProperties();
EmitChangeEvents(true, true, true); EmitChangeEvents(true, true, true);
} }

View File

@@ -68,7 +68,7 @@ https://web.archive.org/web/20161214092913/http://http.developer.nvidia.com:80/C
**** TODO graphics_scale не влияет на растр **** TODO graphics_scale не влияет на растр
**** TODO Оптимизации по скейлу не влияют на растр **** TODO Оптимизации по скейлу не влияют на растр
**** TODO Не работает конвертация в batchmod'е **** TODO Не работает конвертация в batchmod'е
**** TODO Ворнинг при авто-добавлении SortingGroup **** DONE Ворнинг при авто-добавлении SortingGroup
**** TODO Площадь для оптимизации вычисляется некорректно при повёрнутых клипах **** TODO Площадь для оптимизации вычисляется некорректно при повёрнутых клипах
**** TODO Возможно проблемы с DX9 **** TODO Возможно проблемы с DX9
UNITY_UV_STARTS_AT_TOP UNITY_UV_STARTS_AT_TOP