playMaker

Author Topic: UI interaction with GameObject  (Read 560 times)

Fitbie

  • Playmaker Newbie
  • *
  • Posts: 31
UI interaction with GameObject
« 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!

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: UI interaction with GameObject
« Reply #1 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.