How I can detect when my mouse are over attached Transforms on script?
I have an Transform variable on my script, and I need to detect when mouse is over it.
If it’s the transform the script is on just use OnMouseOver. If it’s transforms that are child objects of the transform the script is on have a script on each of them with OnMouseOver in it and have that script tell the script on the parent object that the mouse is over it by doing something like changing a bool in the parent transforms script. You would probably want to let the main script know when the mouse is no longer over one of the child transforms though and having them all turning one bool on and off could potentially cause problems in which case having a list of bools corresponding to each individual child script and having the parent transforms script check the whole list might be the best way to go.
1 Like