Search Unity

Question Accidental press while navigating the map

Discussion in 'Input System' started by yigitdurmuss, Jul 29, 2023.

  1. yigitdurmuss

    yigitdurmuss

    Joined:
    Jun 2, 2022
    Posts:
    22
    Hello, i am working on a game which like farmville. I am currently using Ortographic Camera for cragging and moving.

    Some of my buildings attached with box collider and when player press collider, it triggers OnMouseDown and openning a panel ui for building.

    My question is when players dragging camera in the scene freely, sometimes they can miss click above the building and make the trigger function works.

    How can I make the building be detected only when clicking on it? I mean how do I prevent the player from clicking wrong?

    Note: It's a mobile game but i am using OnMouseDown