static void CreateCutScene() { GameObject newObj = new GameObject("CutScene", typeof(CutScene)); CutScene newScene = newObj.GetComponent <CutScene> (); newScene.AddTrack(CutScene.MediaType.Subtitles); GameObject subtitles = new GameObject("Subtitles"); subtitles.transform.parent = newObj.transform; AnimationClip masterClip = new AnimationClip(); newScene.masterClip = new AnimationClip(); newScene.gameObject.AddComponent <Animation> (); newScene.GetComponent <Animation>().AddClip(masterClip, "master"); newScene.GetComponent <Animation>().playAutomatically = false; newScene.GetComponent <Animation>().wrapMode = WrapMode.Once; }
// Update is called once per frame void Update() { cena = SceneManager.GetActiveScene(); if (cena.name == "Fazenda") { ligar[0].SetActive(true); ligar[1].SetActive(true); cutScene.GetComponent <CutScene>().enabled = true; this.gameObject.SetActive(false); } }