2D Toolkit Forum
2D Toolkit => Support => Topic started by: xikky on September 03, 2014, 07:49:21 pm
-
I know this can be worked out using Physics.Raycast, but is there any other way? and is Physics.Raycast expensive in performance?
Thank you!
-
One raycast is fine, especially if you've put all your UI in layers. We could provide this information but due to how stuff works in Unity, theres no way to guarantee our update has run before your function call.
-
I think I'm not understanding something here :/ .. I thought i could work with ignoring the UI layer but the trouble is that when clicking on a UI element, it's layer is not picked, but the raycast picks layers from behind the UI element.
Can someone provide how I can work around this? thankyou!
-
No I don't think you can ignore the UI layer. What I mean is if you have all your stuff in a UI layer, you can issue 1 cheap raycast to the UI layer only to see if you've clicked on something and the hit point. You can then decide whether or not to issue your raycast to do whatever you need.