- Home /
Solved the problem myself
How to detect OnClick on children of a 3D model
I have an empty gameobject wich contains a bunch of 3D models wich ultimately makes up one big 3D model. I want to detect when a part/child is clicked on and what part is clicked, I know this has been asked and probably answered before but I never really found anything that works for me. How would I go about detecting OnClick for the chlid models?
Answer by tormentoarmagedoom · Apr 12, 2018 at 08:14 AM
Good day.
You have 2 options:
Create a script in every child with OnMouseDown(). So every child will execute its code when is cliked.
Add Event Trigger Component to each child, and configure it for mouse click.
This way you can have diferent results for every child.
If helped, accept the answer and close the question! Bye!
I have allready done this but I hoped there was a way I could do it with only one script (in the parent)..
Follow this Question
Related Questions
Dynamically creating a box collider for an object with multiple, rotated, and scaled mesh renderers 0 Answers
Baking NavMesh at Runtime: Connecting separate NavMeshSurfaces 0 Answers
How to sync children of a gameObject using Photon? 0 Answers
Detecting a mouse click on a custom 2D mesh? 1 Answer
Unity 5 UI Button OnClick 2 Answers