Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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
0
Question by isaiastheweezerd · Jan 05, 2018 at 12:14 AM · camerafpsfps controllercamera script

Switching to the player camera

Hello! In my game i want the scene to open with the map overview, i have already created the animation for the camera to fly around. For the First person player i am using the standard unity asset's FPS controller. After the map overview i want the camera to switch to the FPS controller (camera). I have researched this and found a java script for this.:
#pragma strict

var Camera1 : Camera;
var Camera2 : Camera;
function Start(){

  Camera1.enabled = true;
  Camera2.enabled = false;
  
  yield WaitForSeconds(10);
  Camera1.enabled = false;
  Camera2.enabled = true;

}

Once i went ahead and used the script, it made the transition to the FPS controller as needed, although when it did this i was removed of my ability to move around normally, (Could not move face with mouse, could not jump, Moved very very slowly.) Even if its in C#Sharp or Java script i would like for someone to find the reason for this, or make a new script entirely. Much appreciated.

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
0

Answer by bartbussel · Jan 05, 2018 at 02:47 PM

This should work in C#

 public Camera Camera1;
 public Camera Camera2;

 private void Start()
 {
     StartCoroutine(CameraSwitch());
 }

 IEnumerator CameraSwitch()
 {
     Camera1.enabled = true;
     Camera2.enabled = false;

     yield return new WaitForSeconds(10);

     Camera1.enabled = false;
     Camera2.enabled = true;
 }
Comment
Add comment · Show 1 · 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 isaiastheweezerd · Feb 06, 2018 at 10:33 PM 0
Share

Hi, thanks for your reply. There seems to be no red flags on the script. Although i do have one issue that i think is a simple fix. On the part of the script that says IEnumerator CameraSwitch() the CameraSwitch has the red swiggle, as if something is wrong. Thats the only issue i could find and i think it may be causing this message to appear, in the image i added. If you know why this is happening that would be great. Thanks, and sorry for the VERY late response. (The issue is counted as a compile error so i cant test the game)

[1]: /storage/temp/110793-capture.png

capture.png (66.8 kB)

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.

Follow this Question

Answers Answers and Comments

139 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

how to make my bones follow the camera(FPS) 0 Answers

Problems with Dani's Karlson FPS Movement Controller 1 Answer

FPS 3D camera view problem 0 Answers

Why is the Camera bouncing on the X-Axis?,Why does the Camera jump around on the X-Axis? 1 Answer

First Person Camera looking down 1 Answer


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