Quantcast
Channel: Questions in topic: "renderer.enabled"
Viewing all articles
Browse latest Browse all 99

How to whrite in c# the code: onMouseEnter Hide mesh

$
0
0
Hi, I Am writing a code in c# here is what I have at the moment using UnityEngine; using System.Collections; public class MouseOver1 : MonoBehaviour { void OnMouseEnter(){ renderer.enabled = false; } void OnMouseExit(){ renderer.enabled = true; } } -------------------------------------------------------------------------------------- Im recieving those 2 errors when using the mouse over the cube NullReferenceException: Object reference not set to an instance of an object MouseOver1.OnMouseEnter () (at Assets/MouseOver1.cs:7) UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32, Int32) -------------------------------------------------------------------------------------- NullReferenceException: Object reference not set to an instance of an object MouseOver1.OnMouseExit () (at Assets/MouseOver1.cs:11) UnityEngine.SendMouseEvents:DoSendMouseEvents(Int32, Int32) ---------------------------------------------------------------------------------- The code is indeed attached to the cube or what ever else I try with and the object has a collider. I do not understand what is missing thank you for helping me I am really stuck and I am only at the 1st lines of script in my game :S

Viewing all articles
Browse latest Browse all 99

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>