Exemplo n.º 1
0
    public static void CloseAnimationEditor(NPVoxAnimationEditorSession session)
    {
        NPVoxAnimation animation         = session.animation;
        string         previousScenePath = session.previousScenePath;
        string         editorScenePath   = session.editorScenePath;

        UnityEngine.SceneManagement.Scene editorScene = UnityEngine.SceneManagement.SceneManager.GetSceneByPath(editorScenePath);

        GameObject.DestroyImmediate(session.gameObject);

        if (previousScenePath != null)
        {
            EditorSceneManager.OpenScene(previousScenePath, OpenSceneMode.Additive);
        }
        else
        {
            EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Additive);
        }
        EditorSceneManager.CloseScene(editorScene, true);

        File.Delete(editorScenePath);

        animation.EnsureAllMeshesLoaded();

        Selection.objects = new Object[] { animation };
    }
 protected void Start()
 {
     MeshFilter = this.GetComponent <MeshFilter>();
     if (animation != null)
     {
         animation.EnsureAllMeshesLoaded();
     }
 }
 public void Preview()
 {
     AssetDatabase.SaveAssets();
     animation.EnsureAllMeshesLoaded();
     this.isPlaying             = true;
     this.previewIsPingPongBack = false;
     this.beforePreviewFrame    = this.SelectedFrameIndex;
     SelectFrame(0, true);
 }
    protected void Start()
    {
        MeshFilter = this.GetComponent <MeshFilter>();

        if (animation != null)
        {
            animation.EnsureAllMeshesLoaded();

            if (!Stopped)
            {
                stopped = true;
                Play(true);
            }
        }
    }