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 /
avatar image
0
Question by TritZium · Jun 04, 2015 at 02:00 PM · c#unity 5errormonodevelopparse

C# script parse error

Hello! I'm getting a parse error at line 62 (end of the file) in this code:

 using UnityEngine;
 using System.Collections;
 using System.Collections.Generic;
 
 public class mTile{
     mTile(){
         position = new Vector2();
         neighbours = new List<mTile>();
     }
     public Vector2 position;
     public List<mTile> neighbours;
 };
 
 public class CollisionGenerator : MonoBehaviour {
 
     Dictionary<Vector2, mTile> map;
     List<mTile> firstPathMap;
     public int mapWidht = 0;
     public int mapHeight = 0;
     public float tileDensity = 1.0f;
     //Collision creation goes in two passes, first I create the nodes ( If the node is notWalkable, don't create it)
     //After that I create the relations between the nodes, depending if KeyExists
     void Start(){
         createNodes();
         createRelations();
     }
 
     void createNodes(){
         //First pass
         for(float y = 0; y < mapHeight; y++){
             for(float x = 0; x < mapWidht; x++){
                 Vector2 pos = new Vector2(x + tileDensity/2.0f, y + tileDensity/2.0f);
                 RaycastHit2D[] rayHit2D = Physics2D.RaycastAll(pos, new Vector2(0.0f, 0.0f), 0.1f);
                 foreach(RaycastHit2D rayHit in rayHit2D){
                     if(!rayHit.collider.tag == "Imovable" && !rayHit.collider.tag == "Vent"){
                         //Here the AI can move, create an mTile
                         mTile tmpTile = new mTile();
                         tmpTile.position = pos;
                         map.Add(tmpTile.position, tmpTile);
                     }
                 }
             }
         }
     }
 
     Dictionary<Vector2, mTile> getGraph(){ return map; }
     void createRelations(){
         Vector2[] dirs = new Vector2[8] {
             new Vector2(-0.5f, 0.0f), new Vector2(-0.5f, -0.5f), new Vector2(0.0f, -0.5f), new Vector2(0.5f, -0.5f), 
             new Vector2(0.5f, 0.0f), new Vector2(0.5f, 0.5f), new Vector2(0.0f, 0.5f), new Vector2(-0.5f, 0.5f)
         };
         foreach(KeyValuePair<Vector2, mTile> tile in map){
             for(int i = 0; i < dirs.Length; i++){
                 tile.Value.neighbours.Add(map[tile.Value.position + dirs[i]);
             }
         }
     }
     // Update is called once per frame
     void Update () {
     
     }
 }



Now there is something strange happening in Monodevelop, the last line is also filled with whitespaces and whenever I try to create a newline below createRelations() (hitting enter) it creates a newline... BUT it also fills half the screens width on that line with whitespaces. I've searched a bit but all I can find about parse errors are because of functions named the same thing or missing curly braces, I have checked for both. Thank you very much!

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 Ilgiz · Jun 04, 2015 at 02:03 PM

You missed one ']'

 tile.Value.neighbours.Add(map[tile.Value.position + dirs[i]]);


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 TritZium · Jun 04, 2015 at 02:54 PM 0
Share

R.I.P :'(

Thanks!

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

MonoDevelop4.0.1 Intellisense incorrect 'corrections' 1 Answer

Error MSB3645: .NET Framework v3.5 Service Pack 1 was not found. In order to target ".NETFramework,Version=v3.5", .NET Framework v3.5 Service Pack 1 or later must be installed. (MSB3645) (Assembly-CSharp-firstpass) 2 Answers

NullReferenceException: Object reference not set to an instance of an object 1 Answer

Unity 5.1: MonoDevelop lags a lot on 13 inch Macbook Pro 0 Answers

Assets/_Scripts/Md5.cs(1,15): error CS0116: A namespace can only contain types and namespace declarations 0 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