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 /
This question was closed Nov 08, 2014 at 08:24 PM by Graham-Dunnett for the following reason:

Duplicate Question - http://answers.unity3d.com/questions/topics/bce0019.html

avatar image
0
Question by RedOrion · Nov 08, 2014 at 07:54 PM · javascriptbce0019

object is not a member of 'UnityEngine.Component'.

From what I can tell nothing is wrong....

Assets/Scripts/Pickup.js(7,96): BCE0019: 'hand' is not a member of 'UnityEngine.Component'.

 #pragma strict
 
 function OnTriggerEnter (other : Collider){
     if(other.gameObject.tag == ("Player")){
         other.gameObject.SendMessage ("ItemPickup", transform.parent.gameObject);
         transform.parent.gameObject.rigidbody.isKinematic = true;
         transform.parent.gameObject.transform.parent = other.GetComponent("Inventory").hand.transform;
         transform.parent.gameObject.transform.position = other.GetComponent("Inventory").hand.transform.position;
         transform.parent.gameObject.transform.active = false;
     }
 }
Comment
Comments Locked · Show 1
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 LucasMars · Nov 08, 2014 at 07:57 PM 0
Share

Try changing the variable name to something other than transform, as it may be trying to find a transform of an object that is null.

If that doesn't work, have you tried transform.gameObject.parent

Ins$$anonymous$$d of putting parent first. That is as much I can help, without knowing more code.

1 Reply

  • Sort: 
avatar image
0
Best Answer

Answer by tanoshimi · Nov 08, 2014 at 07:55 PM

GetComponent is returning... a component. Unity components don't have hands.

You want an Inventory, and the easiest way to get that is to use the generic version of GetComponent:

 other.GetComponent.<Inventory>().hand.transform

etc.

Comment
Comments Locked · 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 RedOrion · Nov 08, 2014 at 08:18 PM 0
Share

So what would I get rid of?

avatar image tanoshimi · Nov 08, 2014 at 08:22 PM 0
Share
      transform.parent.gameObject.transform.parent = other.GetComponent("Inventory").hand.transform;
      transform.parent.gameObject.transform.position = other.GetComponent("Inventory").hand.transform.position;

Should be:

      transform.parent.gameObject.transform.parent = other.GetComponent.<Inventory>().hand.transform;
      transform.parent.gameObject.transform.position = other.GetComponent.<Inventory>().hand.transform.position;

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

BCE0019: 'vertices' is not a member of 'Object'. 1 Answer

UnityEngine.GameObject Error 1 Answer

Is it the same javascript 1 Answer

javascript equivalent of Action? 0 Answers

move the ball randomly in unity android 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