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

You are not connected. Please login or register

Unity Ninja Unity 3D Forum » HELP » Help (General) » Why do I get an error????

Why do I get an error????

View previous topic View next topic Go down  Message [Page 1 of 1]

1 Why do I get an error???? on Tue Sep 01, 2015 1:47 pm

BacN


Member [Lv. 0]
Member [Lv. 0]
Code:
if (Distance < lookAtDistance);
   {
      GetComponent,renderer.material.color = Color.yellow;
      lookAt();
   }
   

HELP HELP HELP HELP

View user profile

2 Re: Why do I get an error???? on Tue Sep 08, 2015 12:02 am

supamigit


Member [Lv. 3]
Member [Lv. 3]
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

View user profile

View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum