The following code results in errors...
class Test extends MonoBehaviour
{
public var testObject:GameObject;
function Start()
{
var kFoo:Object = Object.Instantiate(testObject);
}
}
MissingMethodException: Method not found: 'System.Object.Instantiate'. Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.ProduceExtensionDispatcher () Boo.Lang.Runtime.DynamicDispatching.MethodDispatcherFactory.Create () Boo.Lang.Runtime.RuntimeServices.DoCreateMethodDispatcher (System.Object target, System.Type targetType, System.String name, System.Object[] args) Boo.Lang.Runtime.RuntimeServices.CreateMethodDispatcher (System.Object target, System.String name, System.Object[] args) Boo.Lang.Runtime.RuntimeServices+c_AnonStorey13.<>m_7 () Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) 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) Test.Start () (at Assets/Scripts/Test.js:8)
However, if I call Instantiate directly from a GameObject it works...
class Test extends MonoBehaviour
{
public var testObject:GameObject;
function Start()
{
var kFoo:Object = Instantiate(testObject);
}
}
What's up with that? According to all documentation, Instantiate is a static function and calling Object.Instantiate should work just fine. At the very least, I should not be getting different results between the two.
Please advise.
Thanks, Jason