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 /
This question was closed Nov 12, 2015 at 01:37 PM by D-Pope for the following reason:

I solved the problem myself, in the enum line I used the wrong type of brackets I used () instead of {}.

avatar image
0
Question by D-Pope · Nov 12, 2015 at 03:44 PM · c#unity 5errorvariablesmouselook

C# Mouselook Script errors, need assistance.

I was following a video by HyperShadeTutorials(https://www.youtube.com/watch?v=-LJsXN55TC4) in which he teaches you how to create a mouselook script in C#, I have not yet finished it, however, there are multiple errors in the code, I have tried multiple ways to solve the problem to no avail. I wish to test the MouseX movement as he does in Part 2 of his series yet I simply am unable. Please help me, this is extremely fustrating

I would appreciate it if you could explain thoroughly on a solution and what causes the problem, I'm a beginner so any information would be useful to me.

Here is what I have written so far: public class Look : MonoBehaviour {

     public enum RotationAxis (MouseX = 1, MouseY = 2);
 
     public RotationAxis RotXY = RotationAxis.MouseX | RotationAxis.MouseY;
 
     //X Axis
     //sensitivity
     public float xspeed = 200f;
     //Minimum camera angle
     public float xmin = -360f;
     //Maximum camera angle
     public float xmax = 360f;
     float RotationX = 0f;
 
     //Y Axis
     //sensitivity
     public float yspeed = 200f;
     //Minimum camera angle
     public float ymin = -45f;
     //Maximum camera angle
     public float ymax = 45f;
     float RotationY = 0f;
     public Quaternion RotOrigin;
 
 
     void Start () {
         RotOrigin = transform.localRotation;
     }
     
 
     void Update () {
     if (RotXY == RotationAxis.MouseX) {
             RotationX += Input.GetAxis ("Mouse X") * xspeed * Time.deltaTime;
 
             Quaternion Xquat = Quaternion.AngleAxis(RotationX, Vector3.up);
             transform.localRotation = RotOrigin * Xquat;
         }
 
 
     }
 }

--------------------------------------------------------------------------------------------------------------- Errors:
Look.cs(6,34): error cs1519: Unexpected symbol '(' in class, strut or interface member declaration. Look.cs(6,42): error cs1519: Unexpected symbol '=' in class, strut or interface member declaration. Look.cs(6,54): error cs1519: Unexpected symbol '=' in class, strut or interface member declaration.

Note: I have changed the variable names as I prefer shorter ones(don't know why, it's just more aesthetically appealing to me)

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

  • Sort: 
avatar image
0
Best Answer

Answer by gjf · Nov 12, 2015 at 03:44 PM

enums are not defined with () - use {} (curly brackets) instead ;)

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

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

NullReferenceException on Invoke in another class 1 Answer

tengo un problema con este script no puedo hacer que salte el personaje en un 2f,hi i have a problem making my chacter jump with this script 0 Answers

Time.deltatime not working. 1 Answer

error CS0201 1 Answer

Visual Studio 2015 keeps crashing... 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