Hello there!
I’m making main menu when the mouse is on the buttons over screen a image will apears over right.
I making the menu code only for gain experinece. I knew how to check if mouse is over a object using OnMouseOver, but how I can check if it’s over/not over from start_button, creditos_button and quit_button function?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MainMenu : MonoBehaviour
{
public Texture title;
public Texture background_texture;
public Texture Start_texture;
public Texture Credits_texture;
public Texture Quit_texture;
void OnGUI()
{
background_box();
start_button();
credits_button();
quit_button();
}
void start_button()
{
GUI.Button(new Rect(Screen.height / 2 - 10, Screen.width / 2 - 30, 85, 25), "Start Game");
}
void credits_button()
{
GUI.Button(new Rect(Screen.height / 2 - 10, Screen.width / 2 + 5, 85, 25), "Credits");
}
void quit_button()
{
GUI.Button(new Rect(Screen.height / 2 - 10, Screen.width / 2 + 40, 85, 25), "Quit Game");
}
void background_box()
{
GUI.Box(new Rect(Screen.height / 2 - 40, Screen.width / 2 - 38, 150, 115), "");
}
void OnMouseOver()
{
}
}