c# - Error in Unity: Lightning.SetColors(Color, Color)' must have a body because it is not marked abstract, extern, or partial -


the errors exactly:

error (1)

assets/_dinostudios123/match-tree engine/scripts/effects/lightning.cs(7,14): error cs0501: `lightning.setcolors(color, color)' must have body because not marked abstract, extern, or partial

this error caused changing [line.setcolors(color, color);] having add public void setcolors (color start, color end);

error (2)

assets/_dinostudios123/match-tree engine/scripts/effects/lightning.cs(30,14): warning cs0618: unityengine.linerenderer.setvertexcount(int)' obsolete:use numpositions instead.'

could determine why error codes coming when adding in line of code correct color start , color end , correct int count per line?


using unityengine;  using system.collections;  // lightning effect  public class lightning: monobehaviour {      public void setcolors (  //the error applied line of code         color start,         color end     );      public void setvertexcount (         int count     );      public transform start; // start object     public transform end; //end object     public int bend = 2; // bends count     public vector3[] bendpoint; // points of bending     public color color; // start lightning color      public string sortinglayer;     public int sortingorder;      linerenderer line;  //linerenderer line     float distance = 0f;     float lasttime = -100f;     float frequency = 20f;     bool  destroing = false;     vector3 a;     vector3 b;       void  start (){         line = getcomponent<linerenderer>();         bendpoint = new vector3[bend];         line.setcolors(color, color);  //color, color         line.setvertexcount(bend + 2);         line.getcomponent<renderer>().sortinglayername = sortinglayer;         line.sortingorder = sortingorder;          transform.parent = gameobject.find("slots").transform;     }      void  update (){         if (end == null || !end.gameobject.activeself || start == null || !start.gameobject.activeself) {             remove();             return;         }          if (!destroing) {             = start.position;             b = end.position;         }         distance = (a - b).magnitude;         if (lasttime + 1f/frequency < time.time) {             lasttime = time.time;             (int = 0; < bendpoint.length; i++)                 bendpoint[i] = new vector3((2f * random.value - 1f) * 0.1f * distance, (2f * random.value - 1f) * 0.1f * distance, 0f);         }         line.setposition(0, a);         (int i= 1; < bend + 1; i++) {             line.setposition(i, vector3.lerp(a, b, (1f * i)/(bend+1)) + bendpoint[i-1]);         }         line.setposition(bend + 1, b);     }      public void remove() {         startcoroutine(fadeout());     }      ienumerator fadeout (){         if (destroing) yield break;         destroing = true;         while (getcomponent<animation>().isplaying) yield return 0;         getcomponent<animation>().play("lightningfadeout");         while (getcomponent<animation>().isplaying) yield return 0;         destroy(gameobject);     }      // function of creating new lightning effect     public static lightning createlightning (int bend, transform start, transform end, color color) {         lightning newlightning = contentassistant.main.getitem<lightning> ("lightning");         newlightning.bend = bend;         newlightning.start = start;         newlightning.end = end;         newlightning.color = color;         return newlightning;     } } 

the compiler warning you've defined methods parameters no bodies.

adjusting formatting makes easier see it's complaining about:

public void setcolors(color start, color end);  public void setvertexcount(int count); 

you need define bodies methods.

public void setcolors(color start, color end) {     // set starting , ending colors }  public void setvertexcount(int count) {     // set vertex count } 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -