I know that is really confusing, but an example is Who’s Your Daddy. You can open cabinets by clicking on it. You can pick up/hold objects by clicking them. And there are much more examples, but for those whose played it, y’know what I mean.
You need to use a Raycast (Physics.Raycast), using values from the Camera class’s ScreenPointToRay function. The raycast function will return a RayHit, so just assign it to a variable and do
yourRaycastHit.collider.gameObject and then check whether that object can be interacted with, and if so, interact with it.
Alternatively, if You are a newcomer, and don’t feel quite at ease programing in C#, You may consider using Fungus, available also at the Asset Store (for free, MIT licence). I’m actually using it, and have only words of praise. ![]()
It has dedicated OnDragStart and OnDragExecuted, well, let’s call them events: Fungus uses a visual coding approach, and even their examples feature a demo doing exactly what You’ve asked to do, probably more… I advise You check it out ![]()