- Home /
Object Disappears while Drag/Drop
Hi, I was trying drag drop from some tutorial. Everything is working fine but just one thing is not. While Dragging & Dropping from one place to the other object disappears. When drops it appears on the perfect place where I have dropped it. Let me tell you that the object is a prefab. And there are slots where one can drag & drop objects from one place to the another. Please help.
I had similar problem before, the line 22 only work if your base canvas is configured as screen space - overlay, if you use screen space - camera for ui, you will need to do some transformation, because the Input.mousePosition gives the position on the screen that not match with the ui space position, exept if you use overlay of course.
Thanks. It looks like you saved my life. Just need to ask one more thing. After setting canvas to screen space - overlay, my camera looks quite smaller so I increase it's size to 640 from 6.4. Is it advisable to do that?
glad to help, change screensize will modify the Input.mousePosition
values to the new size, so, you dont see any difference, if happens, ask again...
Answer by xxandrew0555xx · Jan 12, 2019 at 05:47 PM
what version of unity are you using it in? If it is 5.3 voids work different on that version be careful on how old that tutorial you are following is
Answer by heyramb89 · Jan 13, 2019 at 07:00 AM
I have Unity 2018 while the tutorial was written in Dec 12, 2014. What should I change in my script.
Your answer
Follow this Question
Related Questions
UI eventsystem Raycast Unity 5 does not recognize parent and child 1 Answer
EventTrigger steals OnDrop but not OnDrag 1 Answer
UI drag and drop 1 Answer
Simple drag and drop - no physics 4 Answers