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 TheRichardGamer · Jun 04, 2013 at 06:49 PM · errorbce0019

BCE0019 Error

I am trying to check a variable from another script but it gives me an error saying that the variable that I am trying to check is not a member in UnityEditor.MonoScript. What is the problem here?

Script:

 #pragma strict
 
 public var BulletPrefab : Rigidbody;
 public var barrelEnd : Transform;
 var Pos1 : Vector3;
 var Pos2 : Vector3;
 var CanShoot = true;
 var SMG : GameObject;
 var IsWalking = false;
 var Aim = false;
 var ReloadScript : MonoScript;
 
 
 function Update () {
 
 
 
 Screen.lockCursor = true;
 
 
 
 if(IsWalking == true){
 
 
 
 
 SMG.animation.Play("Walk_SMG");
 
 
 
 }
 
 else
 
 
 if(IsWalking == false){
 
 
  SMG.animation.Stop("Walk_SMG");
 
 
 }
 
 
 if(Input.GetButton("w")){
 
  CanShoot = false;
 
 
   if(Aim == false){
  IsWalking = true;
 
   }
 
 }
 
 
 else
 
 if(Input.GetButton("a")){
 
  CanShoot = false;
 if(Aim == false){
  IsWalking = true;
 
  }
 
 }
 
 else
 if(Input.GetButton("s")){
 
  CanShoot = false;
 
 if(Aim == false){
  IsWalking = true;
 }
 
 }
 else
 if(Input.GetButton("d")){
 
  CanShoot = false;
  if(Aim == false){
  IsWalking = true;
    }
 
 
 }
 else
 
 if(!Input.GetButton("w")){
 
  CanShoot = true;
 
 
  IsWalking = false;
 
 
 }
 else
 if(!Input.GetButton("a")){
 
  CanShoot = true;
 
 
 IsWalking = false;
 
 
 }
 
 else
 
 if(!Input.GetButton("s")){
 
  CanShoot = true;
 
 
 IsWalking = false;
 
 
 }
 else
 
 if(!Input.GetButton("d")){
 
  CanShoot = true;
 
 IsWalking = false;
 
 
 
 }
 
 
 
 
 
 
 
 
 
 
 if(Input.GetButton("Fire2")){
 
 
 transform.localPosition = Pos2;
 
 Aim = true;
 IsWalking = false;
 
 
 
 
 
 
 }
 
 
 
 if(!Input.GetButton("Fire2")){
 
 
 transform.localPosition = Pos1;
 
 Aim = false;
 
 
 }
 
 
 
 
 
 
     if(Input.GetButtonDown("Fire1")){
     
         if(ReloadScript.AmmoInClip > 0){
         var BulletInstance : Rigidbody;
         BulletInstance = Instantiate(BulletPrefab, barrelEnd.position, barrelEnd.rotation);
         BulletInstance.AddForce(barrelEnd.forward * 8000);
         }
         
         
         else
         
         if(ReloadScript.AmmoInClip == 0){
         
          Debug.Log("Magazine is empty");
         
         
         
       }    
         
  
    }
     
     
 }
 
 
 
Comment
Add comment · Show 3
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 robertbu · Jun 04, 2013 at 06:51 PM 1
Share

Code with improper indenting and large gaps of whitespace is very hard to read. Plus we need to know what line is generating the error. If you doubleclick on the error in the Console window, it will highlight the line with the error in $$anonymous$$ono. Edit your question and insert a comment on the line with the error.

avatar image TheRichardGamer · Jun 04, 2013 at 06:56 PM 0
Share

Here's the line :

if(ReloadScript.AmmoInClip > 0){

avatar image KiraSensei · Jun 04, 2013 at 07:10 PM 0
Share

We cannot answer you if you don't show us the ReloadScript.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by robertbu · Jun 04, 2013 at 07:08 PM

MonoScript is an editor class and not what you want to use to refer to another of your scripts. If your other class is attached to a game object, and if you are initializing variables by dragging and dropping them in the Inspector, then you want to us the name of your script here. Let's say the script is called "Reload". You would do:

 var reload : Reload;

Then you would drag and drop the game object with the Reload script attached onto this variable in the inspector. You would then call it:

 if(reload.AmmoInClip > 0){
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

15 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

Related Questions

Why is this player script not working 1 Answer

Unfixable Assets/Scripts/PlayerAttack.cs(30,15): error CS1525: Unexpected symbol `private' 1 Answer

Unity error "scripts exist in multiple locations" 1 Answer

dont work maxdistance 0 Answers

problem at adding 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