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 arsmen · Jun 09, 2015 at 07:47 PM · scriptingproblem

Help me to fix my script error cs1519

hello im following a tutorial but i have a problem at this point and i dont know where is the prob :(

Assets/Scripts/TileManager.cs(17,67): error CS1519: Unexpected symbol `(' in class, struct, or interface member declaration

using UnityEngine; using System.Collections;

public class TileManager : MonoBehaviour {

 public GameObject[] tilePrefabs;

 public GameObject currentTile;

 private static TileManager instance;


 private Stack<GameObject> leftTiles - new Stack<GameObject>();

 private Stack<GameObject> topTiles - new Stack<GameObject>();

 public static TileManager Instance
 {
     get
     {
         if (instance == null)
         {
             instance = GameObject.FindObjectOfType<TileManager>();
         }
         return instance;
     }
 }
 // Use this for initialization
 void Start () 
 {
     CreateTiles (100); 
     for (int i = 0; i < 3000; i++)
     {
         SpawnTile();
     }
 }
 
 // Update is called once per frame
 void Update () {
 
 }
 public void CreateTiles(int amount)
 {
     for (int i= 0; i < amount; i++)
     {
         leftTiles.Push(Instantiate(tilePrefabs[0])); 
         topTiles.Push(Instantiate(tilePrefabs[1])); 
         topTiles.Peek().SetActive(false);
         leftTiles.Peek().SetActive(false);
     }

 }
 public void SpawnTile()
 {
     if (lefTiles.Count == 0 || topTiles.Count == 0)
     {
         CreateTiles(10);
     }
     int spawnPickUp = Random.Range (0, 8);
     if (spawnPickUp == 0)
     {
         currentTile.transform.GetChild(1).gameObject.SetActive(true);
     }

         int randomIndex = Random.Range (0, 2);

     if (randomIndex == 0)
     {
         GameObject tmp = leftTiles.Pop();
         tmp.SetActive(true);
         tmp.transform.position = currentTile.transform.GetChild(0).transform.GetChild(randomIndex).position; 
         currentTile = tmp;
     }
     else if(randomIndex == 1)
     {
         GameObject tmp = topTiles.Pop();
         tmp.SetActive(true);
         tmp.transform.position = currentTile.transform.GetChild(0).transform.GetChild(randomIndex).position; 
         currentTile = tmp;
     }

     //currentTile = (GameObject)Instantiate (tilePrefabs[randomIndex], currentTile.transform.GetChild(0).transform.GetChild (randomIndex).position, Quaternion.identity);  
 }    

}

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

Answer by dubbreak · Jun 09, 2015 at 08:04 PM

It's a typo of some sort and you didn't copy/paste correctly so it's difficult to say.

Maybe the fact you have a dash instead of = ?

  private Stack<GameObject> leftTiles - new Stack<GameObject>();

If you double click on the error it should take you to the correct line (though sometimes with syntax issues or typos it won't fall on the right line).

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 dubbreak · Jun 17, 2015 at 06:40 PM 0
Share

So did that fix it?

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

unity 3.4 crashes when i get to a certain point in the character generator script? 0 Answers

How to create a UnityScript array and access the data in each cell. 1 Answer

Serialize is working in debug, but it has no effect 0 Answers

How to delete animation event from .fbx file using script 0 Answers

Swapping animation clips at runtime 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