• 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 /
This question was closed Apr 30, 2013 at 06:34 AM by Julien-Lynge for the following reason:

Duplicate Question

avatar image
0
Question by rhemaloon · Apr 30, 2013 at 06:30 AM · playerfirstpersoncontroller

Doing a Tutorial on YouTube by quill18creates, on video 2. Receiving an error CS1525: Unexpected symbol 'verticalRotation' He has the same but no error so why do I? Here's the code

using UnityEngine; using System.Collections;

public class FirstPersonController : MonoBehaviour {

 public float movementSpeed = 5.0f;
 public float mouseSensitivity = 5.0f;
 
 float verticalRotation = 0;
 public float upDownRange = 60.0f;
 
 // Use this for initialization
 void Start () {
     Screen.lockCursor = true;    
 }
 
 // Update is called once per frame
 void Update () {
     //Rotation
     
     float rotLeftRight = Input.GetAxis("Mouse X") * mouseSensitivity;
     transform.Rotate(0, rotLeftRight, 0);
     
     
     verticalRotation -= Input.GetAxis("Mouse Y") * mouseSensitivity
     verticalRotation = Mathf.Clamp(verticalRotation, -upDownRange, upDownRange);
     Camera.main.transform.localRotation = Quaternion.Euler(verticalRotation, 0, 0);
     
     
     // Movement    
     float forwardSpeed = Input.GetAxis("Vertical") * movementSpeed;
     float sideSpeed = Input.GetAxis("Horizontal") * movementSpeed;

     Vector3 speed = new Vector3( sideSpeed, 0, forwardSpeed );
     
     speed = transform.rotation * speed;
     
     CharacterController cc = GetComponent();
     
     cc.SimpleMove( speed );
 }

}

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 Julien-Lynge · Apr 30, 2013 at 06:38 AM 0
Share

This is a very common question. 'Unexpected symbol' errors are typically caused because you've forgotten to close or end something above; e.g., you have a missing ')', ';', etc. There are numerous answers out there, and I'm sure you can figure it out from them:

http://lmgtfy.com/?q=unity+unexpected+symbol

Additionally, anything starting in CS* is an error code, so you should always check that first (in this case, it's not super helpful, but it often is).

avatar image rhemaloon · Apr 30, 2013 at 02:59 PM 0
Share

Thanks, that was a perfect answer!

0 Replies

  • Sort: 

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

14 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

Related Questions

Infinity Hallway 1 Answer

Slow down everything besides Player? 1 Answer

Player Screen Resolution 2 Answers

How to run a script to only 1 player in a multiplayer fps 1 Answer

Player names all displayed as local player 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