Hi, guys right now i have script that creates multiple joints on trigger i want to be able to remove all fixed joints at once anyone have idea how i can do this? Thank you!
When you create a joint add it to a list. once you want to remove all the joints just loop through the list and remove the component.
1 Like
Thank you for the answer but can you please show me example how i create a list ? Thank you!!
using System.Collections.Generics;
//...
List<FixedJoint> myList = new List<FixedJoint>();
FixedJoint myJoint = AddComponent<FixedJoint>();
myList.Add(myJoint);
although you can probably forgo the overhead of setting up your own list and just use “GetComponents” to retrieve all the attached components on the gameobject.
1 Like