Need help with AI

i got 4 errors like this how i can fix this?
Cannot return a value from iterators. Use the yield return statement to return a value, or yield break to end the iteration

I assume you’re trying to do Coroutines. Take a look at how they work. If you need to get values out of a coroutine, another way is to supply a delegate that the coroutine invokes to “pass out” the data. You cannot simply return it.

Show us an example of some code this is occurring with and we will be able to help.

// no target - stop hunting
if(target == null || (TargetAIComponent && !TargetAIComponent.enabled) && !huntPlayer){
timeout = 0.0f;
heardPlayer = false;
heardTarget = false;
damaged = false;
TargetAIComponent = null;
return false;
}

The console says that “return false” is wrong.
http://imgur.com/a/TOAY6

Need to see the function declaration.

If you want to return true or false the function needs to be: bool FunctionName(myParameters)

1 Like

And please OP, use the code tags properly. Look at the first or second post in this forum for guidance.