Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Fitbie on December 03, 2021, 12:28:49 PM

Title: UI interaction with GameObject
Post by: Fitbie on December 03, 2021, 12:28:49 PM
Hi all, I have a quick question. My game implements a primitive inventory system using the default Playmaker array. When dragging an item, I use the Fake Drag system, that is, the inventory cell is deactivate, and a UI Image ("Dragger") is created in its place, taking a sprite depending on the inventory cell. But I have a question: I want the player to be able to use the mouse to give an item to an NPC. I know that UI can interact with GameObject if it has RigitBody2D and Collider2d on it. But the problem is that the UI is displayed on Canvas, and they can't collide with the gameobject(NPC) on scene. How can I solve this problem? Thanks!
Title: Re: UI interaction with GameObject
Post by: Alex Chouls on December 07, 2021, 09:30:34 AM
Try using UI Canvas Enable Raycast to disable raycasting on the canvas so you can pick the player when dragging.