• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Heather · Nov 10, 2010 at 12:46 AM · cameratriggervideotimer

Change main Camera to another camera with a Trigger then back with a Timer.

I'd like to turn off the main camera on the player, then switch to a separate static camera with a Trigger that the player would walk over.
I've seen alot of switching camera scripts, but all with "Input.GetKeyDown".

I figure a timer would work that would be as long as the video i have on a plane, but to go back to the main camera as well.

Any help would be appreciated. Thanks!!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Adam Rademacher · Nov 10, 2010 at 01:11 AM

From as best I can tell this script should point you in the right direction. You'll have to assign camera 1 and camera 2 and the movie texture in the scene when you attach the script to something that has a collider set to be a trigger.

var camera1 : Camera; var camera2 : Camera; var movie : MovieTexture; private var isPlaying : Boolean = false;

function OnTriggerEnter(other : Collider) { if(other.CompareTag("Player")) { camera1.enabled = false; camera2.enabled = true; StartMovie(); } }

function StartMovie() { if(!movie.isPlaying) { movie.Play(); isPlaying = true; } }

function Update() { if(isPlaying && !movie.isPlaying) { camera1.enabled = true; camera2.enabled = false; isPlaying = false; } }

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Enable/Disable script with timer 1 Answer

End Game when hit's water 2 Answers

Camera Scripts 1 Answer

Make Arms Move Slow 0 Answers

Need help with script and trigger, switching cameras 2 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges