Esempio n. 1
0
    // Update
    private void Update( )
    {
#if UNITY_EDITOR
        if (Application.isPlaying)
#endif
        {
            spriteAnimation.Update(Time.deltaTime);
        }

#if UNITY_EDITOR
        else if (AnimationUtility.InAnimationMode() == false)
        {
            CheckIfAtlasDeleted( );

            CheckIfMaterialChange( );

            CheckIfTextureChange( );

            CheckIfAnimationClipsDeleted( );

            if (PrefabUtility.GetPrefabObject(gameObject) != null)
            {
                //Debug.Log( "Break" );
                this.BreakResourcesConnection( );
            }
            else if (this.NeedToBeRebuild( ))
            {
                //Debug.Log("Rebuild");
                this.Regenerate(true);
            }
            else if (m_rSpriteData.HasSharedResources( ))
            {
                //Debug.Log("Break prefab resources connection");
                this.Regenerate(true);                          // Force the whole regeneration to break connection
            }
            else if (this.HasAtlasBeenRefreshed( ))
            {
                //Debug.LogWarning("Update UVs");
                this.UpdateUvs( );
            }
            else if (m_rSpriteSettings.IsAtlasInvalid( ))
            {
                //Debug.LogWarning( "Atlas invalid");
                this.SetDefaultAtlas( );
                this.UpdateUvs( );
            }

            if (this.GetComponent <SkinnedMeshRenderer>( ) != null &&
                Uni2DEditorSmoothBindingGUI.CurrentBoneEditMode == Uni2DEditorSmoothBindingUtils.BoneEditMode.Posing &&
                this.transform == Selection.activeTransform)
            {
                this.UpdatePosing( );
            }
        }
#endif
    }