hey there,
me and a mate are trying to make an object invisible just while hovering,
there must be a mistake in the code.
we tried our best but we did not figure it out.
please help!
thanks a lot!!!
ps.: the 0f actually should be changed into a 0.5f but it doesn’t work either… it should be only slightly invisible
using UnityEngine;
using System.Collections;
public class Invisible : MonoBehaviour
{
private Color initialColor;
void Start()
{
initialColor = renderer.material.color;
}
void OnMouseOver()
{
renderer.material.color = new Color(initialColor.r, initialColor.g, initialColor.b, 0f);
}
void OnMouseExit()
{
renderer.material.color = initialColor;
}
}