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 /
avatar image
0
Question by bloodchylde · Aug 31, 2011 at 03:12 PM · androidcompile-errorbce0019bce0048

Android Compiler Errors

New to scripting, trying to build a tutorial game to the android phone. Getting 2 errors,

BCE0019: 'isMatched' is not a member of 'Object'.

and

BCE0048 Object does not support slicing

With the bce0019 error, theres a couple other items with the same exact error (isFaceUp, img).

I beleive all the issues are contained in this portion of the script:

     class Card extends System.Object
 {
     var isFaceUp:boolean = false;
     var isMatched:boolean = false;
     var img:String;
     var id:int;
     
     function Card(img:String, id:int)
     {
         this.img = img;
         this.id = id;
         }
     }
 function BuildDeck()
 {
     var totalRobots:int = 4;
     var card:Object;
     var id:int = 0;
 
 
     for(i=0; i<totalRobots; i++)
     {
     var aRobotParts:Array = ["Head", "Arm", "Leg"];
     for(j=0; j<2; j++)
     {
         var someNum:int = Random.Range(0, aRobotParts.length);
         var theMissingPart:String = aRobotParts[someNum];
         
         aRobotParts.RemoveAt(someNum);
         
         card = new Card("robot" + (i+1) + "Missing" + theMissingPart, id);
         aCards.Add(card);
         
         card = new Card("robot" + (i+1) + theMissingPart,id);
         aCards.Add(card);
         id++;
         }
     }
 }
 function FlipCardFaceUp(card:Card)
 {
     card.isFaceUp = true;
     if(aCardsFlipped.IndexOf(card) < 0)
     {
     aCardsFlipped.Add(card);
     
     if(aCardsFlipped.Count == 2)
     {
         playerCanClick = false;
         
         yield WaitForSeconds(1);
         if(aCardsFlipped[0].id == aCardsFlipped[1].id)
         {
         //MATCH!
         aCardsFlipped[0].isMatched = true;
         aCardsFlipped[1].isMatched = true;
         
         matchesMade ++;
         
         if(matchesMade >= matchesNeededToWin)
         {
             playerHasWon = true;
         }            
         }
         else
         {
         aCardsFlipped[0].isFaceUp = false;
         aCardsFlipped[1].isFaceUp = false;
         }
         
         aCardsFlipped = new ArrayList();
         
         playerCanClick = true;
         }
 }
 }

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by SisterKy · Aug 31, 2011 at 03:33 PM

Your problem is here:

 var card:Object;

you need instead:

 var card:Card;

The class Card extends the class Object but the variable card is only of class Object not of the extended class Card. And Object does not have a variable isMatched... Greetz, Ky.

Comment
Add comment · Show 12 · 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 bloodchylde · Aug 31, 2011 at 03:42 PM 0
Share

I tried your change, I get the same error when I attempt to build it though.

avatar image bloodchylde · Aug 31, 2011 at 03:44 PM 0
Share

Would it help if I posted the entire script?

avatar image SisterKy · Aug 31, 2011 at 04:10 PM 0
Share

no, I think the sniplet should do... wait a moment... I was so fixed on finding what caused the error that I didn't even think about it... why are you extending from System.Object? I'm not sure if Unity can deal with that the way you want it... I don't have much experience with these things but I think there's probably a reason why they recommend to extend from ScriptableObject class for cases like this...

(and again: I think you are trying to compile, not to build, are you? Please try to use these terms cleanly as they mean quite different things in Unity. compile -> stuff plays in unity editor; build -> stuff plays outside of unity editor)

avatar image bloodchylde · Aug 31, 2011 at 04:28 PM 0
Share

Well, heres what I do. I goto File, Build settings, save as filename.apk, and click build. So during the compile process it fails with those errors. Sorry for being such a newb. Im a 3d modeler/animator, not scripter so this is very unfamiliar to me.

As for the system.object, I am following a tutorial and as described in the tutorial, the system.object I guess acts as a class that everything in Unity is derived from. Its supposed to be nondescript to cover everything not identified. (if im understanding it right)

avatar image SisterKy · Aug 31, 2011 at 04:56 PM 0
Share

oh, no sorry, then you are probably right... I'm unfamiliar with the android-kit and thought it was the same as standard, my bad... blushes (I'm from a artist background, too, btw...) ... but the bce-errors still classify as compiler-errors as opposed to runtime-exceptions...

yes, everything in Unity derives from System.Object, that's correct. (Except maybe Structs but that's another topic entirely...) ... hrm. If it's in your tutorial it has probably been tested and should work...? (I still find it kind of fishy... the recommendations are probably there for a reason and they say our self-made classes should usually derive from $$anonymous$$onoBehaviour or ScriptableObject (which ultimately derive from System.Object themselves))

hm wait... you get the exact same error? Still saying
"'is$$anonymous$$atched' is not a member of 'Object'."? or does it say
"'is$$anonymous$$atched' is not a member of 'Card'."?

Thinking about this some more, you probably still get the exact same error, right? I missed that var card:Object; is a local variable for function BuildDeck and has no influence on stuff in function FlipCardFaceUp (card:Card) where the local variable card already is :Card.... hrmmmm... that's weird!... can you post where you define aCardsFlipped?

Show more comments

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Javascript array problem... 1 Answer

BCE0019: 'mesh' is not a member of 'UnityEngine.Component' on Android Build 2 Answers

Unity 3.4 standard assets not working in iOS builds? 4 Answers

NotificationCenter (from the community wiki) problem 1 Answer

Access JavaScript variables on c# script (Android build fails!) 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