- Home /
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!
Answer by Julian-Glenn · Nov 14, 2013 at 07:33 PM
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 assu$$anonymous$$g that all your models are a decent poly count? Saving a Vec3, again, is $$anonymous$$uscule, even in Andriod/iOS.
It is very $$anonymous$$imal in impact. Same as any engine. That's the way you have to do it. /best of wishes with the game :-)
Answer by KhaledM · May 29, 2014 at 07:43 PM
another workaround is "active" property, it is marked as Obsolete but it still work in v4.5
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
How to destroy linked components when object is destroyed? 1 Answer
AddComponent() causes a "trying to create a MonoBehaviour using the 'new' keyword" warning 2 Answers
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Reseting Component/GameObject to its initial scene state. 4 Answers