- Home /
InvokeRepeating does not call method
I have an abstract class wich calls a wrapper function to call another functon with as parameter an abstract function from lower classes.
The class itself is Enemy and is abstract, Its subclasses are DumbEnemy, SmartEnemy, StationaryEnemy, ...
The subclasses should give their new direction they want to search for the player every second and the superclass "Charachter" than handles their movement. Its all really nicely put together tbh but the problem is that the function to call the new direction isn't called by InvokeRepeating
public abstract class Enemy : Character
{
private static int frequency = 1; // how many seconds to wait look for a new direction;
protected int LifePoints { get; set; }
// Use this for initialization
protected override void Start()
{
base.Start();
LifePoints = 1;
InvokeRepeating("UpdateDirectionWrapper", 1f, 1f);
}
void UpdateDirectionWrapper()
{
base.UpdateDestination(NextDirection());
}
protected abstract Vector3 NextDirection();
...
}
The Strat method is called, I debugged it over a 100 times and you can also checkout this screenshot from the debugger
Yet the debugger never breaks at the second breakpoint, nor does a simple Debug.Log(...); Why is it not called and how do I make it work?
I also tried every access modifier vor the UpdateDirectionWrapper function
Answer by gordiri · Jan 24, 2018 at 10:42 AM
If some class implements class Enemy then this may call function from child class not from Enemy
Your answer
![](https://koobas.hobune.stream/wayback/20220612150816im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Illuminating a 3D object's edges OnMouseOver (script in c#)? 1 Answer
Where to run InvokeRepeating? 1 Answer
Check timer time when changed it. 2 Answers