- Home /
Question by
Jett Dela Cruz · Aug 04, 2013 at 04:15 PM ·
getcomponentpathfinding
Plese help me guys! BCE0019: 'GetComponent' is not a member of 'Object'.
I'm developing a map for pathfinding AI in my mobile game, and i'm really getting confused to fix this error: " Assets/Scripts/AIpathDoorScript.js(40,69): BCE0019: 'GetComponent' is not a member of 'Object'. " it works fine in PC, Mac & Linux development build but i keep on getting errors when i'm running it in an android development build. can someone pls help me, i've tried everything but i can't really fix it. here's the code:
AIpathDoorScript:
var cells = new Array();
var doorsToCells = new Array();
var imediateCells = new Array();
var testForCells : boolean = true;
var waitToTestCells : float = 2;
var stage : int = 1;
@HideInInspector
var doorOpen : boolean = true;
function Awake ()
{
doorOpen = true;
cells = GameObject.FindGameObjectsWithTag("AIpathCell");
doorsToCells.length = cells.length;
testForCells = true;
waitToTestCells = 2;
stage = 1;
}
function Update ()
{
if (testForCells && waitToTestCells <= 0)
{
for (var imediateCell : GameObject in imediateCells)
{
for (var i : int = 0; i <= cells.length - 1; i++)
{
if (cells[i] == imediateCell)
doorsToCells[i] = 1;
}
}
for (stage = 2; stage <= cells.length; stage++)
{
for (i = 0; i <= cells.length - 1; i++)
{
if (doorsToCells[i] == stage - 1)
for (var checkDoor : GameObject in cells[i].GetComponent(AIpathCellScript).doors)
{
if (checkDoor != gameObject)
{
for (var checkCell : GameObject in checkDoor.GetComponent(AIpathDoorScript).imediateCells)
{
for (var j : int = 0; j <= cells.length - 1; j++)
{
if (cells[j] == checkCell && doorsToCells[j] == null)
doorsToCells[j] = stage;
}
}
}
}
}
}
testForCells = false;
}
waitToTestCells -= 1;
}
function OnTriggerEnter (other : Collider)
{
if (other.tag == "AIpathCell")
imediateCells.Add(other.gameObject);
}
Please help here guys.. :(
Comment
@Jett Dela Cruz - I don't know if you are still questions, but your latest question(how to solve this. Operator...) has some sort of glitch. I cannot comment or interact with it. It is just your question. I recommend you delete it and post a new question.