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 Mafflouki · Jan 29, 2019 at 12:45 PM · c#scripting problemscript error

i need help with my board manager coding ASAP

i keep getting this error code

Assets/Scripts/BoardManager.cs(71,15): error CS1525: Unexpected symbol `Vector3'

Coding:

 using UnityEngine;
 using System;
 using System.Collections.Generic;
 using Random = UnityEngine.Random;
 
 public class BoardManager : MonoBehaviour 
 {
 [Serializable]
 public class Count
 {
     public int minimum;
     public int maximum;
     
     public Count (int min, int max)
     {
         minimum = min;
         maximum = max;
     }
 }
 
 public int columns = 8;
 public int rows = 8;
 public Count wallCount = new Count (5,9);
 public Count foodCount = new Count (1,5);
 public GameObject exit;
 public GameObject[] floorTiles;
 public GameObject[] wallTiles;
 public GameObject[] foodTiles;
 public GameObject[] enemyTiles;
 public GameObject[] outerWallTiles;
 
 private Transform boardHolder;
 private List <Vector3> gridPositions = new List <Vector3> ();
 
 void InitialiseList()
 {
     gridPositions.Clear();
     
     for (int x = 1; x < columns - 1; x++)
     {
         for (int y = 1; y < rows - 1; y++)
         {
             gridPositions.Add(new Vector3(x,y,0f));
         }
     }
 }
 
 
 void BoardSetup ()
 {
     boardHolder = new GameObject ("Board").transform;
     
     for (int x = -1; x < columns + 1; x++)
     {
         for (int y = -1; y < rows + 1; y++)
         {
             GameObject toInstantiate = floorTiles[Random.Range (0, floorTiles.Length)];
             if (x == -1 || x == columns || y == -1 || y == rows)
                 toInstantiate = outerWallTiles[Random.Range (0, outerWallTiles.Length)];
             
             GameObject instance = Instantiate(toInstantiate, new Vector3 (x,y,0f), Quaternion.identity) as GameObject;
             
             instance.transform.SetParent(boardHolder);
         }
     }
 }
 
 Vector3 RandomPosition()
 {
     int randomIndex = Random.Range (0, gridPositions.Count)
 Vector3 randomPosition = gridPosition [randomIndex];
     gridPositions.RemoveAt (randomIndex);
     return randomPosition;
 }
 
 void LayoutObjectAtRandom(GameObject[] tileArray, int minimum, int maximum)
 {
     int objectCount = Random.Range (minimum, maximim + 1);
     
     for (int i = 0; i < objectCount; i++)
     {
         Vector3 randomPositions = RandomPosition();
         GameObject tileChoice = tileArray[Random.Range (0, tileArray.Length)];
         Instantiate (tileChoice, RandomPosition(), Quaternion.identity);
     }
 }
 
 public void SetupScene (int level)
 {
     BoardSetup ();
     InitialiseList ();
     LayoutObjectAtRandom (wallTiles, wallCount.minimum, wallCount.maximum);
     LayoutObjectAtRandom (foodTiles, foodCount.minimum, foodCount.maximum);
     int enemyCount = (int)Mathf.Log (level, 2f);
     LayoutObjectAtRandom (enemyTiles, enemyCount, enemyCount);
     Instantiate (exit, new Vector3 (columns - 1, rows - 1, 0f), Quaternion.identity);
     
 }

}

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 avataremrys · Jan 29, 2019 at 11:28 AM 0
Share

int objectCount = Random.Range ($$anonymous$$imum, maximim + 1);

*should be maximum

avatar image tormentoarmagedoom · Jan 29, 2019 at 12:23 PM 3
Share

Come on man!

Read the error code.... If says something is unexpected is because there should be something in that place.... like a ;

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by NoseKills · Mar 03, 2016 at 07:06 AM

A missing semicolon at the end of the line before it

 int randomIndex = Random.Range (0, gridPositions.Count)
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 Mafflouki · Mar 03, 2016 at 08:05 AM -1
Share

i pasted that on 70 but im still getting the error :/

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

126 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 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

Can someone tell me what is wrong with this script? 1 Answer

How do you copy an image from the clipboard into an ui image? 0 Answers

Problem with Score/Highscore script 0 Answers

Can someone please help me find out what wrong with my code. 0 Answers

Help with Script 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