Unity Ninja Unity 3D Forum
To have exclusive access to all downloads, recourses and links within this forum, a free registered account is required. Just a heads up Wink
Share
Go down
Member [Lv. 0]
Member [Lv. 0]
Posts : 1
Points : 1061
Rep : 0
Join date : 2015-08-28
View user profile

Why do I get an error????

on Tue Sep 01, 2015 1:47 pm
Code:
if (Distance < lookAtDistance);
   {
      GetComponent,renderer.material.color = Color.yellow;
      lookAt();
   }
   

HELP HELP HELP HELP
Member [Lv. 3]
Member [Lv. 3]
Posts : 25
Points : 1754
Rep : 7
Join date : 2013-12-14
View user profile

Re: Why do I get an error????

on Tue Sep 08, 2015 12:02 am
BacN wrote:
Code:
if (Distance < lookAtDistance);
   {
      GetComponent,renderer.material.color = Color.yellow;
      lookAt();
   }
   

HELP HELP HELP HELP

Okay so have some Inconsistance with how format of a method or function is built
is base format....... not sure of your whole code but basically below is how it should look
You had semi colon at end of if(); can end this way..
look at your commas vs Period/Dots when calling object structure

Code:
public class Test : MonoBehaviour {

   public float Distance;
   public float lookAtDistance;
        Renderer renderer;   

   // Use this for initialization
   void Start () {
   
   }
   
   // Update is called once per frame
   void Update () {
      if (Distance < lookAtDistance)
      {
         renderer.material.color = Color.yellow;
         lookAt();
      }
   }

   void lookAt(){

   }
}


Also all in doubt this
http://docs.unity3d.com/ScriptReference/Renderer-material.html
Will be your primary understanding and fix
Back to top
Permissions in this forum:
You cannot reply to topics in this forum