This question was 
             closed Oct 06, 2016 at 06:13 AM by 
             NoseKills for the following reason: 
             
 
            Duplicate question http://answers.unity3d.com/questions/1252150/mathflerp-time-problems.html#answer-1252194
 
               Question by 
               ttham · Oct 05, 2016 at 05:39 PM · 
                c#scripting problemlerpscriptingbasics  
              
 
              Mathf.Lerp not working
 void Update () {
         
         EmSourse.GetComponent<Renderer> ().material.color = LightColour;
         EmSourse.GetComponent<Renderer> ().material.SetColor("_EmissionColor", LightColour * EmStregh);
 //        mylight.GetComponent<Light> ().color = new Color (LightColour);
 
         Ray ray = camera.ScreenPointToRay (Input.mousePosition);
         RaycastHit hit;
 
 
 
         if (Physics.Raycast (ray, out hit)) {
 
 
             if (Input.GetMouseButtonDown (0) && hit.collider.tag == "swich") {
 
                 klick = !klick;
             
 
             }
         }
 
 
         if (klick == true) {
                                                                             
                 t += SwichSpeed * Time.deltaTime;
             mylight.intensity = Mathf.Lerp (0.0f, 2.0f, t);
 
             EmStregh = Mathf.Lerp (0.0f, 30.0f, t);
 
                 Quaternion targetRotation = Quaternion.Euler (25, 0, 0);
                 mySwich.transform.localRotation = Quaternion.Slerp (transform.localRotation, targetRotation, t);
 
             } 
 
 
             else {
                 
                 t += SwichSpeed * Time.deltaTime;
             mylight.intensity = Mathf.Lerp (2.0f, 0.0f, t);
 
             EmStregh = Mathf.Lerp (30.0f, 0.0f, t);
 
                 Quaternion targetRotation = Quaternion.Euler (-25, 0, 0);
                 mySwich.transform.localRotation = Quaternion.Slerp (transform.localRotation, targetRotation, t);
 
 
             }
 
               HI! I have a swich here and a lamp, overall its working, switch is switching and light goes on and off but no lerp effect.What am I dooing wrong here? I'm a total noob, so if you can type some kind of exemple, what i need to fix.And explanation would be awsome.Thank You.And sorry for disturbance.
               Comment