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 /
  • Help Room /
avatar image
0
Question by EMT_Sam · Apr 26, 2017 at 02:18 AM · error messagecamera rotatenewbie

Brand new to Unity; setting up camera rotation and getting error CS1519: Unexpected symbol `)' in class, struct, or interface member declaration

using UnityEngine;

[RequireComponent(typeof(PlayerMotor))]

public class PlayerController : MonoBehaviour {

 [SerializeField]
 private float speed = 5f;
 [SerializeField]
 private float lookSensitivity = 3f;

 private PlayerMotor motor;

 void Start ()
 {
     motor = GetComponent<PlayerMotor> ();
 }

 void Update ()
 {
     float _xMov = Input.GetAxisRaw ("Horizontal");
     float _zMov = Input.GetAxisRaw ("Vertical");

     Vector3 moveHorizontal = transform.right * _xMov; 
     Vector3 moveVertical = transform.forward * _zMov; 

     Vector3 velocity = (moveHorizontal + moveVertical).normalized * speed;

     //Apply movement 
     motor.Move (velocity);

     //Calculate rotation as 3D vector (turning around)
     float _yRot = Input.GetAxisRaw("Mouse X");

     Vector3 _rotation = new Vector3 (0f, _yRot, 0f) * lookSensitivity;

     //Apply rotation
     motor.Rotate(_rotation);
 }
     

 //Calculate camera rotation as 3D vector (turning around)
 float _xRot = Input.GetAxisRaw("Mouse Y");

 Vector3 _cameraRotation = new Vector3 (_xRot, 0f, 0f) * lookSensitivity;

 //Apply camera rotation
 motor.RotateCamera (_cameraRotation)

}

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
1
Best Answer

Answer by Matthewj866 · Apr 26, 2017 at 02:50 AM

Hi there.

All this means is "lol you have a syntax error, go find it".

motor.RotateCamera (_cameraRotation) is missing a semicolon. I didn't spot any other syntax errors in your code, but if this doesn't fix it then there are more.

Hope this helps.

Comment
Add comment · Show 4 · 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 EMT_Sam · Apr 26, 2017 at 08:52 PM 0
Share

That doesn't seem to fix it. I'm trying to set up the camera so that it will rotate up and down, but after adding the semicolon, motor.RotateCamera (_cameraRotation); is still not working. Since I am new, this script is based off of a tutorial series on YouTube, and the video was made in 2015. Could I be typing something that is no longer needed, or missing something that I would need that was not needed in 2015? I apologies if this isn't helpful, but I am $$anonymous$$ching myself and started only 3 days ago, so I barley even know what it is I'm doing AT$$anonymous$$.

avatar image Matthewj866 EMT_Sam · Apr 27, 2017 at 12:17 AM 0
Share

Unity is a bit weird in the sense that it will flat out ignore scripts if they don't run correctly.

As mundane as it sounds I assume you saved the change? Unity doesn't run code that it can't compile and only uses the latest saved version.

Are there any new errors when you add that change?

Are you new to just Unity or C# as well?

Sorry if some of these questions are a bit mundane, but it's always good to check.

avatar image EMT_Sam Matthewj866 · Apr 27, 2017 at 01:30 AM 0
Share

It's no problem.

Yes I saved and saved again to be sure.

No difference after adding change

I'm new to both Unity and C#. Backstory is I have a game design class and we just started coding for Unity. I won't attend next year but I still want to learn.

I should have noted that there is a second script: Player$$anonymous$$otor. It's where _cameraRotaion is based, however there are no errors in that script. The only problem in the entire system is that motor.RotateCamera (_cameraRotation); is not being recognized, or working; therefore I cannot enter play mode because of the error, and even if I could I still wouldn't be able to move up and down.

Show more comments

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

100 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

Related Questions

How to resolve this lightning error? 0 Answers

Error CS0019 line 72,27 operator '== cannot be applied to operands of type unityengine.gameobject and string 1 Answer

Camera gets closer to the player when looking at it from certain angles. 0 Answers

error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement 2 Answers

I am trying to build an empty project to android just so I can get it working but I am hitting several issues. the latest of which is a "failed to re-package resources" error. 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