Question by
Naivion · Jan 20, 2017 at 12:53 AM ·
functionparameters
Failed to call fundtion... on this script which makes no sense
ok the issue is a odd one this is the error message...
Failed to call function RemoveZombie of class Ai Calling function RemoveZombie with no parameters but the function requires 1. UnityEngine.GameObject:SendMessage(String, Object, SendMessageOptions) Ai:Update() (at Assets/scripts/movement/Ai.cs:125)
getting a error about the function failing to call due to lack of parameter makes little sense to me as the code checks if the thing it passes as the parameter exists before trying to send it... any ideas?
if(target != null && Targets.Count != 0)
{
GameObject[] Zombies;
Zombies = GameObject.FindGameObjectsWithTag("Enemy");
foreach (GameObject zombie in Zombies)
{
zombie.SendMessage("RemoveZombie", target, SendMessageOptions.DontRequireReceiver);
}
}
`
Comment
Your answer

Follow this Question
Related Questions
Function overloading with and optional arguments 1 Answer
Is this bug known? function parameter s and if statements c# 1 Answer
Component as parameter 1 Answer
Put array in function 'parameters ? 2 Answers
Simple Question 2 Answers