Im trying to teleport the player however it sets me back to the original location / reset.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CutScene1 : MonoBehaviour
{
public GameObject CutSceneCam;
public GameObject Audio;
public GameObject Collider;
public GameObject Enemy;
public GameObject Collider2;
public GameObject Licht;
public GameObject Playeraudio;
public GameObject DoorSound;
public GameObject Player;
public GameObject Fade;
public GameObject VoiceLine_003;
//void Start(){
//Fade.gameObject.SetActive(false);
//}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Player")
{
Fade.gameObject.SetActive(false);
StartCoroutine(Cutscene());
StartCoroutine(PlayAudio2());
}
}
IEnumerator Cutscene()
{
Fade.SetActive(true);
CutSceneCam.SetActive(true);
Audio.SetActive(true);
Player.SetActive(false);
Collider2.SetActive(true);
Licht.SetActive(true);
Player.transform.position = new Vector3(267, 15, 375);
yield return new WaitForSeconds(11.1f);
Fade.SetActive(false);
Fade.SetActive(true);
Player.SetActive(true);
CutSceneCam.SetActive(false);
Audio.SetActive(false);
DoorSound.SetActive(false);
Enemy.SetActive(true);
Collider.SetActive(false);
Collider2.SetActive(false);
Licht.SetActive(false);
Playeraudio.SetActive(false);
// also tried to put it here maybe it needed to be on (the player itself)
yield return new WaitForSeconds(2f);
Fade.SetActive(false);
VoiceLine_003.SetActive(true);
yield return new WaitForSeconds(3f);
VoiceLine_003.SetActive(false);
}
IEnumerator PlayAudio2()
{
Playeraudio.SetActive(false);
yield return new WaitForSeconds(6.1f);
Playeraudio.SetActive(true);
}
}
Im aware of the errors in the console however they are not connected to this script I’m working on that too. (My friend made that script I’m cleaning up his mess)
I used this forum to get the teleport code: