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 Garth2013 · Oct 16, 2015 at 08:48 PM · debugging

Help dubugging some beginner code

Hi All,

I need a little help as I am being driven crazy by the code below constantly coming up with errors CS1525, 0642 and 0116. Can anyone see something I cant? I am extremely new to all of this!!

Thanks in advance peeps

Gareth

using UnityEngine; using UnityEngine.UI; using System.Collections;

public class TextController : MonoBehaviour {

 public Text text;
 
 private enum States {cell, mirror, sheets_0, lock_0, cell_mirror, sheets_1, lock_1, freedom};
 private States myState;
 
 // Use this for initialization
 void Start () {
     myState = States.cell;
 }
 
 // Update is called once per frame
 void Update () {
     print (myState);
     if (myState == States.cell) {
         state_cell();
     } else if (myState == States.sheets_0 {
         state_sheets_0();
     }
 }
 
 void state_cell () {
     text.text = "You are in a prison cell, and you want to escape " +
                 "some dirty sheets on the bed, a mirror on the wall and the door " +
                 "is locked from the outside.\n\n" +
                 "Press S to view Sheets, Press M to view Mirror or L to view Lock" ;
     if (Input.GetKeyDown(KeyCode.S)){
         myState = States.sheets_0; 
     }
 }                
 void state_sheets_0 () {
         text.text = "You can't believe you sleep in these sheets, surely it's time " +
                     "somebody changed them. The pleasure of prison life  " +
                     "I guess!\n\n" +
                     "Press R to Return to roaming your cell" ;
         if (Input.GetKeyDown(KeyCode.R)){
             myState = States.cell;                     
     }

}

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

2 Replies

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

Answer by PictonicStudio · Oct 17, 2015 at 06:53 AM

alt text

You forgot to close your parentheses :)


fixed.png (5.0 kB)
Comment
Add comment · 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
0

Answer by Garth2013 · Oct 17, 2015 at 11:03 AM

Doh! Thanks for that,, sometimes you just can't see for looking!!!!

Legend!

Comment
Add comment · 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

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

31 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

Related Questions

Set 3D animation as Legacy(Debug Menu Grayed Out!) 0 Answers

Collection was modified; enumeration operation may not compute 0 Answers

Debug logging style has changed by default? 0 Answers

Trouble Attaching Unity Editor to Process for MonoDevelop debugging'... 1 Answer

Unity 5.1.1 is skipping code lines 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