• 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 Tim.Holman · Aug 25, 2011 at 03:11 PM · cameratriggerstartactive

Active camera on Start

I have two cameras in my scene; one in first person and the other in third person. I want the first person camera (tagged as MainCamera) to be the active camera when the game starts. Once the player hits a trigger, the second camera should then become active. I cannot seem to figure out how to disable the second camera when starting. How do I ensure that only the main camera is active when starting?

Comment
Add comment · Show 2
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
avatar image sharat · Aug 25, 2011 at 03:22 PM 0
Share

I'm having a similar problem where the $$anonymous$$ainCamera tag isn't working for assigning the first camera. $$anonymous$$y current workaround is to disable all the other cameras so that only one camera component is enabled at a time. Still, I'd like to know if there's a better way to do this.

avatar image Waz · Aug 25, 2011 at 03:24 PM 0
Share

Both should probably stay tagged $$anonymous$$ainCamera. This tag is used for Camera.main, and it only finds active cameras.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Waz · Aug 25, 2011 at 03:21 PM

Simply set the GameObject inactive in the scene - the little checkbox top-left in the Inspector.

Then to swap cameras:

 camera1.gameObject.active = false;
 camera2.gameObject.active = true;

If you want to transition between the two cameras, you will be better with just one camera (which you move between two locations).

Comment
Add comment · Show 2 · 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
avatar image Joshua · Aug 25, 2011 at 03:52 PM 0
Share

If you´re instantiating prefabs you have to set the ones you don´t want to be active through code as well, because every prefab+it's children gets instantiated as active=true.

avatar image sharat · Aug 25, 2011 at 05:38 PM 0
Share

You can also set just the Camera component to be inactive. That should work for prefabs as well.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Is it bad to add a mouse Lock at MouseLook Script? 1 Answer

OnTriggerEnter is called too late (after Start) 2 Answers

Camera switching : C# onTriggerEnter not working 1 Answer

How do i align my camera with a gameobjects x and y axis? 1 Answer

How would I put a first person player become child to a vehicle? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges