- Home /
Drag'n'Drop control Image raycast in code.
I want Drag'n'Drop UI Images between Panels. I found few ways to disable raycasting for provide successful call of onDrop
event method:
Implement
IsRaycastLocationValid
method for dragged Image;Set
GetComponent<UnityEngine.UI.Image>().raycastTarget
tofalse
inOnDragBeggin
method;Move Image to Layer which ignored by raycast;
Add CanvasGroup component to Image object and change
Blocks Raycasts
property.
Which cons and pros in this ways?
Your answer
Follow this Question
Related Questions
UI Raycast to UI element position 0 Answers
How to use both NGUI widgets and unity UI 0 Answers
Difficulties with world space canvas interaction 1 Answer
UI button and raycast script that I have made both aren't working to change my scene 1 Answer
What's an easy way to align a UI element with a Raycast? 0 Answers