} //END TypeChanged //----------------------------------------------// private void RemoveExistingComponent() //----------------------------------------------// { //If this tween already exists, destroy it if( tween != null ) { tween.PrepareForDestroy(); #if UNITY_EDITOR //Wait a moment before calling DestroyImmediate to make sure no logic is running UnityEditor.EditorApplication.delayCall += () => { DestroyImmediate( tween ); //After the component is deleted, add the new one! AddNewComponent(); }; #else Destroy( tween ); #endif } else { #if UNITY_EDITOR //If in the editor and there was no tween to destroy, go ahead and make the new tween AddNewComponent(); #endif } } //END RemoveExistingComponent
} //END IsPaused //-------------------------// public void Stop() //-------------------------// { if( tween != null ) { tween.Stop(); tween.PrepareForDestroy(); Destroy( tween.gameObject ); } } //END Stop