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 schwertfisch · Jan 16, 2011 at 06:55 PM · iosgetcomponentbce0019dynamic typing

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

Ive read here about a similar problem with dynamic typing in Unity iOS, where one doesnt get a warning just until they try to build.

I have this function for example in a script:

function  RecountEmpties (){
    var occupiedSquaresObserver = GameObject.Find("VacancyTestersParent").GetComponent("VacancyTesterParentController");
    occupiedSquaresObserver.RecountEmpties();
}

the function above does the following things:

1) it searches for the object named "VacancyTestersParent"

2) it gets "VacancyTesterParentController.js" that is attached on this object

3) it runs the function RecountEmpties thats in this script.

It all runs ok when using Unity Remote, but when I hit Build & Run, I get:

...BCE0019: RecountEmpties is ont a member of UnityEngine.Component.

I tried following the solution of the link above (with the similar problem) to somehow modify the syntax but It didnt work (obviously I did it wrong).

Basically I hadnt heard about dynamic typing till now...

What would be the correct syntax for iOS?

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 Peter G · Jan 16, 2011 at 07:05 PM

Unity Remote is just streaming a low quality version of the editor to the iPhone so you will never get any iPhone specific bugs using it. That is why some shaders will work in Unity remote, but not on the actual device.

Here is what you are doing:

  1. Find the "VacancyTestersParent.

  2. Find a Component with the name VacancyTesterParentController

  3. Tell this component to RecountEmpties().

I guess you figured out that you are dynamically typing. Since you did not specify a type for occupiedSquaresObserver, iOS will not let Unity determine it at runtime.

Since GetComponent returns a component, occupiedSquaresObserver is a Component type. But, if you look through the scripting reference, then you will see that Component doesn't have a RecountEmpties method.

In order to fix the problem, you have to declare a type for your object. In C#, you have to do this when you declare a variable, but js's var syntax let's you avoid it.

var occupiedSquaresObserver : VacancyTesterParentController = GameObject.Find("VacancyTestersParent").GetComponent("VacancyTesterParentController") as VacancyTesterController;
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 schwertfisch · Jan 16, 2011 at 07:19 PM 0
Share

thank so much Peter! That fixed it. I also found the following link that one can read about this matter: http://unity3d.com/support/documentation/ScriptReference/index.Performance_Optimization.html

avatar image
1

Answer by Jessy · Jan 16, 2011 at 08:05 PM

You can cut down on code, and you improve performance, by using:

var occupiedSquaresObserver = GameObject.Find("VacancyTestersParent").GetComponent.<VacancyTesterParentController>();

In JavaScript, occupiedSquaresObserver will automatically store a VacancyTesterParentController , so you don't need a colon.

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 schwertfisch · Jan 17, 2011 at 08:42 AM 0
Share

Thank you Jessy, will try that!

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

BCE0019: is not a member of 'UnityEngine.Component' when trying to Build and Run iOS Unity 2 Answers

TWO GUI texture that doesn't work together 0 Answers

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

Enable MeshRenderer from all objects in array 1 Answer

iOS Build Error, runs normal in play mode 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