- Home /
Having some trouble with GetComponent(ScriptName"); Missing Method Exception.
function Update(){
var enemyUnits = GameObject.FindGameObjectsWithTag("Enemy");
var enemyAIScript = enemyUnits.GetComponent(EnemyAI);
That's not the whole script but it's the bit I'm having trouble with. In the console I get an error of
"Boo.Lang.Runtime.RuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args) UnityScript.Lang.UnityRuntimeServices.Invoke (System.Object target, System.String name, System.Object[] args, System.Type scriptBaseType) ControlAI.Update () (at Assets/FORCE/Enemies/RegularUnits/ControlAI.js:28)
I've tried using it with and without the quotation marks but it still doesn't work? Am I using the GetComponent wrong ? Forgot to mention but the EnemyAI is meant to be a seperate script attached to game objects with the tag enemy. I've triple checked and the script is definitely attached to the objects but it still doesn't read.
Thanks In Advance Stealth
Your answer
Follow this Question
Related Questions
How to have GetComponentWithTag return more than one object? 2 Answers
GetComponent getting the whole Object instead of a script. 1 Answer
Follow up to AI Pathfinding Question 0 Answers
Shooting AI problem 2 Answers
Help. GetComponent(Script) not returning anything - Missing method exception 2 Answers