Hey everyone! I am very new to coding and unity overall, so please forgive my overall ignorance in this area; I am learning though!
Ok, so I am trying to have a realtime cutscene happen when the player gets to a certain spot on the level. Right now, I have it set up to switch to a different camera other than the main camera on my FPSController for the animation. The code looks like this:
var CutCam : Camera;
var MainCamera : Camera;
var camClip : AnimationClip;
function OnTriggerEnter(col : Collider) {
if(col.gameObject.tag=="Player"){
GameObject.Find("First Person Controller").GetComponent(FPSInputController).enabled = false;
GameObject.Find("Graphics").GetComponent(MeshRenderer).enabled = false;
CutCam.camera.enabled = true;
MainCamera.camera.enabled = false;
ladder.animation.Play();
}
}
However, when I play the game, it only shows the animation of the CutCam looking up the ladder. It doesn’t start on the FPS if this script is active anywhere.
I have this code placed on a box collider at the point I want the animation to start playing in the level.
Thanks in advance for anything you can do to help!
Hey everyone! Thank you for your responses! I did end up getting it to work! I did as Zongo79 said and moved my camera enabling and disabling scripts into a Start function. And thanks for mentioning Movie Textures as I have just started to play around with those also!
– OpenDoorsIf 'Zongo79' answered your question, please click on the checkmark to the left of the question to close it out. Thanks.
– robertbu