Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 /
This question was closed Mar 31, 2015 at 05:38 PM by tanoshimi for the following reason:

Problem is not reproducible or outdated

avatar image
0
Question by TheNobleKnight · Mar 31, 2015 at 10:27 AM · c#2derror

How do I fix my compiler errors? (Probably simple to solve)

(Background)

Hello. I am a total scrub at Unity and programing overall so if you've got a little more experience than I do, this will most likely be easy to solve. I've been trying to create some kind of 2D, platform game as my very first project and everything worked as it was supposed to until I tried to make the game restart when my character collided with the ground. I got the message "All compiler errors have to be fixed..." and "Assets/PlayerMove.cs(27,37): error CS1041: Identifier expected". I then removed the code I added but these messages is still there and prevents me from starting the game so I suppose I accidently removed/added something else.

(The code)

 using UnityEngine;
 using System.Collections;
 
 public class PlayerMove : MonoBehaviour {
     public float speedForce= 5f;
     
     void Start () {
         
     }
     
     void FixedUpdate () {
         if (Input.GetKey (KeyCode.A)) {    
             rigidbody2D.velocity = new Vector2 (-speedForce, rigidbody2D.velocity.y);
         } else if (Input.GetKey (KeyCode.D)) {
             rigidbody2D.velocity = new Vector2 (speedForce, rigidbody2D.velocity.y);
         } else if(Input.GetKey (KeyCode.W)) {
             rigidbody2D.AddForce(new Vector2(0, 10), ForceMode2D.Impulse);
         }
         else{
             rigidbody2D.velocity = new Vector2 (0, rigidbody2D.velocity.y);
         }
   }
 } 

I would be really grateful if someone would care to solve and explain the problem since I can't seem to find any solution anywhere. I'm obviously new to this community aswell so be gentle guys.

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 gjf · Mar 31, 2015 at 09:19 AM 0
Share

even total scrubs need to format all of their code ;)

the line number of your error is meaningless without it... there's no line 27 in the posted code.

avatar image TheNobleKnight · Mar 31, 2015 at 09:42 AM 0
Share

Nvm, I fixed it somehow.. Don't really know what I'm doing but atleast I can now start the game again.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

2D platformer- getting errors I don't understand (c#) 1 Answer

How can I make this GameObjects array remain permanent when i activate? 1 Answer

Dying Script error 2 Answers

Please help me with my 2D animations - c# 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