Is it possible to detect click on different created game objects

I am still quite new to Defold so apologies in advance for the potentially obvious answer but I couldn’t figure out if there was a way to detect a click on different game objects. I understand that if I want to select a particular game object I can do:

function on_input(self, action_id, action)
    if action == go.get_position("nameOfGameObject") then
        print("Object selected")
    end
end

But this only detects if the user clicks on a particular game object. Is there a way to detect if the user is clicking on a game object and if the user is then return the value/name of the game object?

Take a look at cursor example here: https://github.com/britzl/defold-input

6 Likes

Sorry for the late reply but this is exactly what I was looking for, thanks!

5 Likes