Unable to Call Instantiate in Class Member Function
- by onguarde
The following javascript is attached to a gameObject.
var instance : GameObject;
class eg_class {
function eg_func(){
var thePrefab : GameObject;
instance = Instantiate(thePrefab);
}
}
Error,
Unknown identifier: 'instance'.
Unknown identifier: 'Instantiate'.
Questions,
1) Why is it that "instance" cannot be accessed within a class? Isn't it supposed to be a public variable?
2) "Instantiate" function works in Start()/Update() root functions. Is there a way to make it work from within member functions?
Thanks in advance!