okay, so I am using the ninjasnowwar method of instantiatin a xml node. It has a script instance on it. Called "Character"
I spawn it:
Node@ spawn_player(){
XMLFile@ xml = cache.GetResource("XMLFile", "Scripts/character.xml");
return scene_.InstantiateXML(xml, Vector3(0.0f,0.0f,0.0f), Quaternion());
}
Then when I try to grab the scripobject:
void Start(){
Node@ player_ = spawn_player();
//Character@ c_ = cast<Character>(player_.GetScriptObject("Character"));
Character@ c_ = cast<Character>(player_.scriptObject);
Print(c_.temp);
}
the character script looks like this:
class Character:ScriptObject{
int temp;
Character(){
temp = 9999;
}
}
The print function gives me an error:
Exception ‘Null pointer access’ in ‘void Start()’ with either method (the non commented and the commented).
Am i going at this wrong? Am i trying to access it before it is instantiated?
Thanks