Question by 
               kamil30307 · Oct 15, 2017 at 01:46 PM · 
                c#gameobjectif-statementscolor changeonmouseover  
              
 
              OnMouseOver wont work with fps Controller
I wanted to use this code in FPS Controller added by default (by simply adding it) It would change material color if it is a pickable object. Unfortunetly it isn`t working for some reason. Script alone works fine when added to that object. Whats worng? Any ideas? I would greatly apreciate any help guys!
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class ObjectHighlight : MonoBehaviour {
 
     private Color StartColor;
 
     void OnMouseEnter()
     {
         if (gameObject.tag == "Interactable")
             
         StartColor = GetComponent<Renderer> ().material.color;
         GetComponent<Renderer> ().material.color = Color.yellow;
     }
 
     void OnMouseExit()
     {
         GetComponent<Renderer> ().material.color = StartColor;
     }
 }
 
 
              
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
How to get parent with component on collision? 0 Answers
Status Effect Help 0 Answers
How to make a floppy object 1 Answer