Hi, I am only going to show you snippets of codes, as the full scripts are too long.
The first script is where all the data is stored and has lots of functions to manipulate it. The function in question is like the one below (There are more, but they produce the same error):
var dataDict = new Dictionary.<int,LifeClass>();
public class InfoClass
{
var id : int;
var object : GameObject;
var script : Lifeform;
}
public class LifeClass
{
var self = InfoClass();
var mother = InfoClass();
var father = InfoClass();
var partner = InfoClass();
var children : List.<InfoClass> = new List.<InfoClass>();
}
...
function GetMother(targetId : int, mode : int)
{
if (mode == 0)
return dataDict[targetId].mother.id;
else if (mode == 1)
return dataDict[targetId].mother.object;
else if (mode == 2)
return dataDict[targetId].mother.script;
}
The second script that controls the AI, is where the functions are called. I am trying to keep a level of abstraction, to make everything easier for the user (me) to understand:
d = gameObject.Find("Data").GetComponent(Data);
...
d.GetMother(id, 1).transform;
Error reads ‘transform’ is not a member of ‘Object’.
It should be a member as its type is GameObject.
What am I overlooking? Or is this just not possible?
Thanks for your time, sorry for the large amount of text.
Magnus