So i'm currently coding a draughts game, but i'm having troubles dealing with one thing. I have a selector which travels the whole draughts board and if it collides with a white/black piece, it highlights red to indicate you are hovering over it. I have a function called "public void OnTriggerStay" Waiting for the user to press return to parent the selector to the draught piece. Up in void Update I have a function waiting for you to press 'q' to unparent the selector from the draught piece but, if the selector is already attached to a draught piece and it collides with another draught piece on the table, it treats the piece that was previously parented as the selector so the selector becomes the draught piece and the original selector is gone. Any Suggestions on how to fix this to stop collisions once an object has been parented and to enable collisions once it has been un-parented. Any help is greatfully appreciated. Thanks.
Answer by UnityCoach
4 days ago
transform.parent = null;
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
4 People are following this question.
how do i fix all compiler errors so i can enter playmode?
How to Make Unity Web Player work offline?
How to declare an 3-dimensional array in C#?
[SOLVED] Stop counting score code error!
[arsing error 26,22 help!