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

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