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 Chrisg · Jan 27, 2011 at 10:31 AM · iosbce0019pragmastrict

BCE0019: component is not a member of 'Object'

Project has thus far been compiling fine, ran into some issues that seem to be caused by not using #pragma strict when compiling for iOS, but "fixing" them has resulted with this:

Using the (slightly snipped) code

var selected; var master;

 function update()
 {
 selected = master.GetComponent("Master_control").selected as Master_control;
 }

results in "BCE0019: 'GetComponent' is not a member of 'Object'.", with tag and transform popping up later in the script for the same error.

I've tried casting as gameObject, GameObject, and Object to no luck, though I'm now confused on the difference between the first two.

Any ideas?

UPD1: New code:

#pragma strict var selected : GameObject; var master : GameObject;

function Update () {

 selected = master.GetComponent.<Master_control>.selected;

}

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 Jessy · Jan 27, 2011 at 01:52 PM

m_r_d_e gave the answer. However, your script has other problems.

If master were a GameObject or Component, then what'd you actually need is

selected = (master.GetComponent("Master_control") as Master_control).selected;

But that uses the GetComponent that takes a string, which is no good. You could improve its performance by doing

selected = (master.GetComponent(Master_control) as Master_control).selected;

But that's long. Use the generic form, which is as yet undocumented. :-P

selected = master.GetComponent.<Master_control>().selected;
Comment
Add comment · Show 3 · 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 Chrisg · Jan 28, 2011 at 01:29 PM 0
Share

Thanks both. Oddly enough, Jessy's second suggestion works, but the first(and m_r_d_e's) return formatting errors("expecting ), found 'master'", etc).

The third also hasn't worked. I've updated the question with the code. It returns the errors: BCE0138: 'UnityEngine.GameObject.GetComponent' is not a generic definition. and BCE0019: 'selected' is not a member of 'error'.

The second error strikes me as quite odd but after three restarts(one of which was a full computer reboot), I'm thinking it's not a bugged out client.

avatar image Jessy · Jan 28, 2011 at 02:50 PM 0
Share

Sorry, I forgot parentheses in the Generic form. Should be good now. I have no idea what's wrong with the first example; I can't reproduce that error.

avatar image Chrisg · Jan 29, 2011 at 02:05 AM 0
Share

That sorted it, thanks. The first is probably just the result of another mistake that works higher in the code.

avatar image
1

Answer by mrde · Jan 27, 2011 at 10:44 AM

in your code master is Object, it must be GameObject or Component and then try this

selected = ((Master_control)master.GetComponent("Mater_control")).selected;

Comment
Add comment · Show 1 · 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 Matthew 5 · Mar 28, 2011 at 10:18 PM 0
Share

this is found to be a problem of $$anonymous$$e aswell, just defining the object as a GameObject fixed my issues.

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

No one has followed this question yet.

Related Questions

Pragma Strict Question/Problem 1 Answer

dynamic typing in Unity iOS: ...not a member of 'UnityEngine.Component' 2 Answers

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

pragma strict issues with iOS 1 Answer

BCE0019: 'mesh' is not a member of 'UnityEngine.Component' on Android Build 2 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