hey,how can i make that a game object in unity(in my case its a cube) will be used as a button,for example in a menu,so when i press on it(on the cube) it will do an action like going to another scene,or exiting the game(and how can i make theese functions-of going to a new scene and exit the game)
also,how can i change the game resolution in the game?-so i have an options menu in my game,that the player can change the options so it will work good for his computer?
Declare a RaycastHit variable named hit. Don't assign anything to this, it's unnecessary as the raycast will do that for you.
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
Find the ray which goes through where the mouse is on the screen. This matters because the view rom a camera isn't flat, the top left of the screen points in a different direction to the bottom right.
if (Physics.Raycast (ray,hit,100.0)) {
Fire the ray into the scene. If it hits something, the function will return true, and hit will be assigned to with the information about what was hit.