I want to click an object so that an event can be fired. This event will actually invoke a script linked to another object. How can I make an object “clickable”, in other words receive mouse clicks?
Also something important, how can I reference a GameObject or component inside a script? By using the “name.” convention could I access properties, functions of a gameobject in my scene or I should create an instance first?
Clicking an object on screen: Fire a raycast from the camera to the point you clicked at …use one of the camera functions…i forgot the specific one:
GameObject.Find(“gameobjectsnamecurrentlyinthescene”)
This isn’t fast though, and there are other methods to access a gameobject (e.g. get a child or parent of the current object)
GetComponent(myscript).value=5;
Thank you for the quick reply. Everything worked.