Question by 
               francodejean · May 29, 2021 at 06:46 PM · 
                c#errormovementfunction  
              
 
              I do a enemy movement function and doesnt work
I do this function (Srry for my english, im not native):
 public void MoveEnemy(float a, float b, Vector3 position)
 {
     position -= new Vector3(-a * Time.deltaTime, b * Time.deltaTime, 0);
 }
 
               and when i put it in my enemy script i put it like this:
 public float speedV, speedH;
 Functions functions;
 void Start()
 {
     functions = FindObjectOfType<Functions>();
 }
 void Update()
 {
     // I put values in this variables for testing.
    speedH = 1;
    speedV = 1;
    functions.MoveEnemy(speedH, speedV, transform.position);
 }
 
               And doesnt move... i dont know why. if i put this code it moves:
  transform.position -= new Vector3(-speedH * Time.deltaTime, speedV * Time.deltaTime, 0);
 
               so, why doesnt move when i do it as a function???
plz help
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Make object move back and forth 2 Answers
[C#] The left-hand side of an assignment must be a variable, a property or an indexer 0 Answers
Why am I getting this error "Object reference not set to an instance of an object" 1 Answer
Implementing a "flyer" game in with the old CardBoard Google sdk 2 Answers
Can't add Orbital script - "The script needs to derive from MonoBehaviour!" 0 Answers