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 Jul 14, 2014 at 09:56 PM by Graham-Dunnett for the following reason:

Duplicate Question

avatar image
0
Question by Vyrum · Jul 14, 2014 at 09:48 PM · cs8025cs1525cs1519

5 Errors, Need help, Unexpected symbol private etc

Assets/Scripts/Drops/MobDrops.cs(134,55): error CS1525: Unexpected symbol private', expecting identifier'

Assets/Scripts/Drops/MobDrops.cs(135,41): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement

Assets/Scripts/Drops/MobDrops.cs(135,48): error CS1525: Unexpected symbol )', expecting ;'

Assets/Scripts/Drops/MobDrops.cs(139,23): error CS1519: Unexpected symbol `=' in class, struct, or interface member declaration

Assets/Scripts/Drops/MobDrops.cs(141,9): error CS8025: Parsing error

I dont understand whats wrong, there are 5 errors. If you can help please let me know what im not seeing, thanks!

Code Under Here

 using UnityEngine;
 using System.Collections;
 using System.Collections.Generic;
 
 [RequireComponent(typeof(BoxCollider))]
 [RequireComponent(typeof(AudioSource))]
 public class MobDrops : MonoBehaviour {
     public enum State{
         open,
         close,
         inbetween
     }
 
     public GameObject[] parts; // parts to increase brightness of
     private Color[] _defaultColors;
 
     public GameObject particleEffect;
 
     public AudioClip openSound; // sound for opeing the drop
 
     public float maxDistance = 3; //max distance the player can  be to open the loot
 
     public State state;
     public int WaitTime = 3;
 
     public GameObject _player;
     private Transform _myTransform;
 
     public bool inUse = false;
     private bool _used = false;         //track if loot has been used or not
 
     public List<Item> _loot = new List<Item>();
 
 
 
     // Use this for initialization
     void Start () {
         _myTransform = transform;
 
         state = MobDrops.State.close;
 
         particleEffect.active = false;
 
         if(!_used)
             PopulateLoot (5);
 
         _defaultColors = new Color [parts.Length];
 
         if (parts.Length > 0)
             for (int cnt = 0; cnt < _defaultColors.Length; cnt++)
                 _defaultColors [cnt] = parts [cnt].renderer.material.GetColor ("_Color");
     }
 
     void Update(){
         if(!inUse)
             return;
         if(_player == null)
             return;
         if(Vector3.Distance(transform.position, _player.transform.position) > maxDistance)
             myGUI.loot.ForceClose();
             //       Messenger.Broadcast("CloseLoot");
     }
 
     public void OnMouseEnter(){
         Debug.Log ("Enter");
         HighLight (true);
     }
 
     public void OnMouseExit(){
         Debug.Log ("Exit");
         HighLight (false);
     }
 
     public void OnMouseUp(){
         Debug.Log ("Up");
 
         GameObject go = GameObject.FindGameObjectWithTag ("Player");
 
         if (go == null)
             return;
         if(Vector3.Distance(_myTransform.position, go.transform.position)> maxDistance && !inUse)
             return;
 
         switch(state){
             case State.open:
             state = MobDrops.State.inbetween;
             StartCoroutine("Close");
             ForceClose();
             Debug.Log ("Im Closing");
                 break;
             case State.close:
             if(myGUI.loot != null){
                 myGUI.loot.ForceClose();
             }
             state = MobDrops.State.inbetween;
             StartCoroutine("Open");
             Debug.Log ("Im Opening");
                 break;
 
 
         }
         //if(state == MobDrops.State.close)
         //    Open ();
         //else
         //    Close ();
     }
 
 
     private IEnumerator Open(){
         myGUI.loot = this;
         // animation.Play("AnimationName");  //for when we have animation if we do
 
         //audio.PlayOneShot (openSound); // plays the sound attached to openSound
         _player = GameObject.FindGameObjectWithTag("Player");
         inUse = true;
 
         particleEffect.active = true;
 
         yield return new WaitForSeconds (WaitTime); //waits for the WaitTime amount
         // change the state to open
         state = MobDrops.State.open;
         //create and display 5 items
         //Messenger<int>.Broadcast("PopulateLoot", 5, MessengerMode.REQUIRE_LISTENER);
         Messenger.Broadcast ("DisplayLoot");
     }
 
 
     private IEnumerator Close(){
         // animation.Play("AnimationName");  //for when we have animation if we do
         _player = null;
         inUse = false;
         particleEffect.active = false;
         yield return new WaitForSeconds (WaitTime); //waits for the WaitTime amount
         state = MobDrops.State.close;
         if(_loot.Count == 0){
             Destroy(gameObject);
 
         }
     }
 
 
     private void PopulateLoot(int x){
         for(int cnt = 0; cnt < x; cnt++){
             _loot.Add(new Item());
             _loot[cnt].Name = "I:" + Random.Range(0,100);
         }
         _used =true;
     }
 
 
 
     public void ForceClose(){
         Messenger.Broadcast ("CloseLoot");
 
         StopCoroutine ("Open");
         StartCoroutine ("Close");
     }
     private void HighLight(bool glow){
         if (glow){
             if (parts.Length > 0)
             for (int cnt = 0; cnt < _defaultColors.Length; cnt++)
                  parts [cnt].renderer.material.SetColor("_Color", Color.yellow);
         }else{
             if (parts.Length > 0)
             for (int cnt = 0; cnt < _defaultColors.Length; cnt++)
                  parts [cnt].renderer.material.SetColor("_Color", _defaultColors[cnt]);
         }
     }
 
 
 }

Comment
Comments Locked · 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 Jeff-Kesselman · Jul 14, 2014 at 09:52 PM 1
Share

There is something very wrong with your code post because like 134 does not have the symbol 'private" on it or anywhere near it.

It looks like the messages refer to a different version of the file then the one you posted.

avatar image Graham-Dunnett ♦♦ · Jul 14, 2014 at 09:55 PM 1
Share

I tagged your question with the error messages. If you click on these tags, you'll see where people have asked the same questions before. Searching is good.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

PLEASE HELP!!!! using BergZurgArcades guide having error! 5 Answers

Why have Chinese compile the script will fail??? 2 Answers

Really Simple C# Errors I Can't Figure Out 1 Answer

Unexpected symbols 0 Answers

Whats wrong with this script? 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