How to get an intro cinematic to play
Hey all,
I'm trying to get an intro cutscene to play, something simple that just flies towards the starting position of the player and then gives control to the player. The intro just plays over and over again. I'm sure its something simple but I can't seem to figure it out for the life of me. I have this script attached to my cutscene camera
public class CameraFunction : MonoBehaviour {
public GameObject player;
public void TriggerPlayer()
{
player.SetActive (true);
this.gameObject.SetActive (false);
}
and I dragged the player into the player function of the camera function script. The cutscene will just play over and over again but won't give control to the player. Any help would be appreciated, thank you.
That was the script given in the video provided by my professor (this is for a class). But the video was very unhelpful. Right now i've wrote this since the provided script didn't follow the rest of the tutorials given.
public GameObject player;
public GameObject playercam;
// Use this for initialization
void Start () {
player.SetActive (true);
playercam.SetActive (true);
this.gameObject.SetActive (false);
}
So the player and playercam do get trigger to on after I hit play, but the cutscene does not play. I think it has something to do with the void Start(), so i'm trying to research the alternatives to void Start() to allow the cutscene to play before the SetActives are set to true. This is my first class doing this in Unity so I'm still learning the basics.
Answer by iStronk · Sep 19, 2015 at 03:02 PM
I figured it out! By replacing void Start() with void CameraPoint1() and then adding that event to the end of the animation it works just fine. I'm sure there are more efficient methods to do this?
Your answer