It did sound very simple to me in the beginning…but somehow i mixed it up too much.
I have a scene with a few buttons and some objects.
I want that when i mouse hover over button1…object1 appears…otherwise the object1 is invisible.
using UnityEngine;
using System.Collections;
public class ShowTown : MonoBehaviour {
public GameObject place = null;
private void OnMouseOver()
{
if (place != null && place.gameObject != null) {
place.gameObject.SetActive(true) = place.gameObject.SetActive(false);
}
}
}
This is what i have so far but it doesnt work. I just wanted to drag the object in the inspector when the script works.
But…i did something wrong with the “place.gameObject.SetActive(true/false)”