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 Jean-Fabre · Aug 17, 2010 at 06:14 PM · connectedbodymissingfieldexception

connectedBody error when used in script

Hi,

I encounter a weird issue where I can't set the connectedBody of a configurable joint in my script.

I get the following:

MissingFieldException: Field 'UnityEngine.ConfigurableJoint.connectedBody' not found. Boo.Lang.Runtime.PropertyDispatcherFactory.EmitPropertyDispatcher (System.Reflection.PropertyInfo property, SetOrGet gos) Boo.Lang.Runtime.PropertyDispatcherFactory.EmitDispatcherFor (System.Reflection.MemberInfo info, SetOrGet gos) Boo.Lang.Runtime.PropertyDispatcherFactory.Create (SetOrGet gos) Boo.Lang.Runtime.PropertyDispatcherFactory.CreateSetter () Boo.Lang.Runtime.RuntimeServices.DoCreatePropSetDispatcher (System.Object target, System.Type type, System.String name, System.Object value) Boo.Lang.Runtime.RuntimeServices.CreatePropSetDispatcher (System.Object target, System.String name, System.Object value) Boo.Lang.Runtime.RuntimeServices+<>c_DisplayClass13.b_12 () Boo.Lang.Runtime.DispatcherCache.Get (Boo.Lang.Runtime.DispatcherKey key, Boo.Lang.Runtime.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, System.Object[] args, Boo.Lang.Runtime.DispatcherFactory factory) [0x00000] Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Object[] args, Boo.Lang.Runtime.DispatcherFactory factory) [0x00000] Boo.Lang.Runtime.RuntimeServices.SetProperty (System.Object target, System.String name, System.Object value) rig builder.Awake () (at Assets/rig builder.js:19)

What is really weird is that in the project view in my prefab, using the inspector doesn't work neither I get the list of available nodes I can select but nothing is actually set and connectedBody fields remains empty. There is only one way and it's in the scene itself, but that defeats the purpose of setting it up.

Any help or advice is welcome. Here is the script in question just in case.

function Awake(){

 var frame = GameObject.Find("physics_frame_tracks");
 var frame_colliderComp = frame.AddComponent(BoxCollider);
 var frame_rigidbodyComp = frame.AddComponent(Rigidbody);
     frame_rigidbodyComp.isKinematic = true;


 var bodyRB = GameObject.Find("physics_body");
 var body_colliderComp = bodyRB.AddComponent(MeshCollider);
     body_colliderComp.convex = true;

 var body_rigidbodyComp = bodyRB.AddComponent(Rigidbody);

 var frame_joint = frame.AddComponent(ConfigurableJoint);
 frame_joint.connectedBody = bodyRB; // !!!!!error here!!!!

note that ALL the other properties of the configurableJoint can be set properly without problem in this script too,

Thanks for your help,

Jean

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
Best Answer

Answer by Jean-Fabre · Aug 18, 2010 at 12:55 PM

ok,

The problem is odd, it actually fails because I was passing the wrong type as value, connectedBody expect a RigidBody component, and I was passing the GameObject instead.

This is confusing, but kind of make sense once you know it. I would expect a bit more documentation on this, if it is there, I missed it sorry and would like to hear about where exactly this kind of juggling is described.

the last line must be

frame_joint.connectedBody = bodyRB.GetComponent(Rigidbody);

and it all works fine then.

see http://answers.unity3d.com/questions/18453/convert-gameobject-to-rigidbody-type/

for the same problem the other way round ( cause if you try this on a var you declare yourself, the error is different and more at first more appropriate).

Jean

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 bwheatley · Jun 23, 2012 at 07:54 AM 0
Share

The new link for the answer you posted is now http://answers.unity3d.com/questions/25320/convert-gameobject-to-rigidbody-type.html

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

changing the connectedBody of a joint on another GO 0 Answers

Hinge Joint strange behaviour 0 Answers

Missing Field Exception 1 Answer

Hinges in an imported mesh 0 Answers

How do i Instantiate multiple game objects with Hinge joints that have there Connected body to the previous Instantiated game object? 0 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