Okay, so basically what I’m trying to do is click on a object and get it assigned as a var. If I click on another one, I want it to be the var instead of the one I previously clicked. How can I do this?
- In your Update handler, check for mouse down
- When mouse is down, get the mouse position from Input
- COnvert the mosue position to a pick ray using Camera.main.ScreenPointToRay
- Cast the ray and find the object it intersects using Physics.Raycast
- Assign that object to your variable