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 epichi123 · May 09, 2014 at 11:33 PM · pause menuerrormessage

Need help with errors BCE0019, BCE005 and Bce0034

I was working on a pause menu script and two kinds of errors popped up.

Assets/Scripts/Pause Menu.js(22,28): BCE0019 'enabled' is not a member of 'UnityEditor.MonoScript'. Assets/Scripts/Pause Menu.js(23,19): BCE0019 'enabled' is not a member of 'UnityEditor.MonoScript'. Assets/Scripts/Pause Menu.js(24,9): BCE0019 'enabled' is not a member of 'UnityEditor.MonoScript'. Assets/Scripts/Pause Menu.js(25,16): BCE0019 'enabled' is not a member of 'UnityEditor.MonoScript'. and more...

Assets/Scripts/Pause Menu.js(24,9): BCE005: Unknown identifier: 'CharacterMoter'

The whole script is:

 #pragma strict
 
 var PauseGUI : GUIText;
 var paused : boolean = false;
 
 private var FPSInputController : MonoScript;
 private var MouseLook : MonoScript;
 private var CharacterMotor : MonoScript;
 private var Player : MonoScript;
 
 function Start ()
 {
 
 CharacterMotor = GetComponent(MonoScript);
 Player = GetComponent(MonoScript);
 MouseLook = GetComponent(MonoScript);
 FPSInputController = GetComponent(MonoScript);
     
     paused = false;
     Time.timeScale = 1;
     PauseGUI.enabled =  false;
     FPSInputController.enabled = true;
     MouseLook.enabled = true;
     CharacterMoter.enabled = true;
     Player.enabled = true;
 }
     
 function Update ()
 {
             if (Input.GetKeyDown("p") && paused == false)
             {
                     paused = true;
                     Time.timeScale = 0;
                     PauseGUI.enabled = true;
                     FPSInputController.enabled = false;
                     MouseLook.enabled = false;;
                     CharacterMoter.enabled = false;;
                     Player.enabled = false;
             }
             else if (Input.GetKeyDown("p") && paused == true)
             {
                     paused = false;
                     Time.timeScale = 1;
                     PauseGUI.enabled = false;
                     FPSInputController.enabled = true;
                     MouseLook.enabled = true;
                     CharacterMoter.enabled = true;
                     Player.enabled = true;
             }
     }


Thanks in advance!

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 AlucardJay · May 09, 2014 at 11:49 PM 0
Share

Wow, I have never seen GetComponent used like that. Does $$anonymous$$onoScript work for a component? If it does, then how do you know which $$anonymous$$onoScript you have stored a reference to?

All your variable names are the names of classes (which could lead to issues/conflicts), this is why the standard convention for variable names is to use camelCase.

I would use GetComponent using the name of the class (class as a component) :

 character$$anonymous$$otor = GetComponent(Character$$anonymous$$otor);
 player = GetComponent(PlayerScript);
 mouseLook = GetComponent($$anonymous$$ouseLook);
 fpsInputController = GetComponent(FPSInputController);
avatar image robertbu · May 10, 2014 at 12:15 AM 0
Share

@alucardj - $$anonymous$$onoScript is derived from TextAsset. It is an editor only class and used to store the text of a script. It cannot be used as he is attempting. I believe the OP is just confused about how to declare and initialize the variables.

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Mr.Hal · May 10, 2014 at 12:33 AM

What you want to do is make

 private var FPSInputController : MonoScript;
 private var MouseLook : MonoScript;
 private var CharacterMotor : MonoScript;
 private var Player : MonoScript;

to

 private var FPSInputController : FPSInputController;
 private var MouseLook : MouseLook;
 private var CharacterMotor : CharacterMotor;
 private var Player : PlayerScript;

You also need to get the components like how agoalucardj said in the question comments. You can't use GetComponent or enabled on Monoscripts but you can on MonoBehaviour because Monoscripts are inherited from TextAssets, and are not inherited from Components. And for some strange reason this doesn't work, remove "private" from your "var"s and assign the scripts in the inspector and avoid getcomponent completly.

I would also rewrite your update function, Pretty inefficient. but your start function seems fine though.

 function Update ()
 {
             if (Input.GetKeyDown("p"))
             {
                     paused != paused;
                     if(paused){
                     Time.timeScale = 0;
                     PauseGUI.enabled = true;
                     FPSInputController.enabled = false;
                     MouseLook.enabled = false;;
                     CharacterMoter.enabled = false;;
                     Player.enabled = false;}
                     else{
                     Time.timeScale = 1;
                     PauseGUI.enabled = false;
                     FPSInputController.enabled = true;
                     MouseLook.enabled = true;
                     CharacterMoter.enabled = true;
                     Player.enabled = true;}
             }
     }

Comment
Add comment · Show 2 · 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 Mr.Hal · May 10, 2014 at 12:35 AM 0
Share

Oh and you have a misspelling for Character$$anonymous$$otor...

avatar image epichi123 · May 11, 2014 at 01:16 AM 0
Share

Thanks for your help but there is a new error now...

Assets/scripts/Pause $$anonymous$$enu.js(27,12): BCE0034 : Expressions in statements must only be executed for their side-effects

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

22 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

Related Questions

Material on mesh 0 Answers

InvalidOperationException: EnsureRunningOnMainThread can only be called from the main thread 2 Answers

GUI Skin Not Working With Static Bool 2 Answers

Pause Game 1 Answer

When exiting pause menu, player wont move at all 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