Question by 
               joshua-lyness · Dec 30, 2015 at 09:28 PM · 
                vector3functionfunctionsidentifier  
              
 
              Vector3 not an identifier?
I am trying to write a function that finds a point on a Bezier curve. I need it to output a vector 3 co ordinate however it keeps giving me an error saying "identifier expected". Isnt the first phrase "Vector3" the identifier here!? heres a screenshot of some of the errors :/ 
     //function to find point on curve
     Vector3 curveEquation(p0 : Vector3, p1 : Vector3, p2 : Vector3, p3 : Vector3, t : float)
     private Vector3 p4;
     private Vector3 p5;
     private Vector3 p6;
     private Vector3 p7;
     private Vector3 p8;
     private Vector3 p9;
     {
         
         p4 = Vector3.Lerp(p0,p1,t);
         p5 = Vector3.Lerp(p1,p2,t);
         p6 = Vector3.Lerp(p2,p3,t);
         p7 = Vector3.Lerp(p4,p5,t);
         p8 = Vector3.Lerp(p5,p6,t);
         p9 = Vector3.Lerp(p7,p8,t);
 
         return p9;
     }
 }
 
                 
                screenshot-3.png 
                (241.7 kB) 
               
 
              
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by NoseKills · Dec 31, 2015 at 12:14 AM
1) you are mixing C# syntax with UnityScript syntax
 Vector3 curveEquation(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float  t)
 //not
 Vector3 curveEquation(p0 : Vector3, p1 : Vector3, p2 : Vector3, p3 : Vector3, t : float)
2) you cannot declare fields between a function declaration and that function's body { }
 private Vector3 p4; // <- a field, accessible in the whole class
 Vector3 curveEquation(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float t)
 {
     Vector2 p5 // <- a local vector only accessible in this method 
     // your method stuff
 }
 // not
 Vector3 curveEquation(Vector3 p0, Vector3 p1, Vector3 p2, Vector3 p3, float t)
 private Vector3 p4;
 {
     // your method stuff
 }
Your answer
 
 
             Follow this Question
Related Questions
How can I thread this function? 0 Answers
How do I get all of my code in start function 1 Answer
Problem with Contains 0 Answers
Need help making my code more efficient 0 Answers
Method Group 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                