enabling and disabling hingeJoint in Unity 4.3

Hinge Joint “enabled” property disappeared in 4.3, is this a joke? How am I supposed to enable/disable this component now? rigidbody’s “enabled” property disappeared too…

I know that I can use Destroy() disable it and use AddComponent<>() to enable it instead of “enabled” property as a workaround but it’s a silly workaround. Any ideas?

Funny thing is that hingJoint2D and rigidBody2D has the “enabled” property!

2 Answers

2

Component.Destroy(theComponent);
or
Destroy(theComponent);

Only way to do it that I can gather from the info provided.
It’s prolly more efficient to handle it in a script anyhoo?

/julian

Thanks for the answer but like I said it's not a good solution, it will require to save the component's parameters in (Vector3, int, float..) before destroying the component. Because when I'll be adding it again I need to set these parameters back. This is unnecessary work on the CPU and wasting memory, I'm doing this on a lot of Objects in the scene and I'm doing it a lot.

That's they way we all do it. You save information and then you retrieve it. Unless you are working with a Commodore 64 you will be fine. Im assuming that all your models are a decent poly count? Saving a Vec3, again, is minuscule, even in Andriod/iOS.

I guess that there is no other option than that... thanks

It is very minimal in impact. Same as any engine. That's the way you have to do it. /best of wishes with the game :-)

another workaround is “active” property, it is marked as Obsolete but it still work in v4.5

Isnt it simply replaced by SetActive now?

There is no SetActive for components