- Home /
Can one click trigger 2 colliders?
I want onmousedown to be triggered on an 2 colliders, one on a parent object that encompasses the collider on the child. is this possible?
Not without scripting some kind of scripted solution. But then you wouldn't need a child collider. You could do a Send$$anonymous$$essage, or roll a more efficient solution by just calling a method on a cached component.
I have several game objects that are clickable parented together to an object with a collider to allow the user to pan across all of the objects. I want to set it up so that the objects can be clicked as well. I'm not sure I understand the idea of calling a method on a cached component.
Are you building your GUI of just game objects, or are you using a third party GUI solution like ngui or ezgui?
If you want to be able to drag a collection of selectable things, have everything listen to the mouse/touch up event. When you drag your panel, simply tell all of the selections to ignore touch ups. When the draggable object gets it's mouse up, notify its children to allow selection again. You may have to delay the red able signal to the draggable panel's children by a frame.
Answer by vikingfabian-com · Dec 08, 2013 at 07:55 AM
Ive got two ideas for your problem:
Turn off the collider in the parent object and run a new raycast, that should pick up the child
Let the child objects know what their parent is when creating them, and store it in a variable. Don't have any colliders on the parent object, the the children tell the parent about the click event.