I’m trying to load in a single object but my NodeScript.model (GameObject) reads as none.
IS BUNDLE prints fine so the bundle is def getting loaded but the contains logic isnt running as if there is no object named WP_Book_Time in the bundle…but there is…
Any ideas what is happening here?
if(assetBundle)
{
print("IS BUNDLE"+assetBundle);
if(assetBundle.Contains("WP_Book_Time"))
{
print("CONTAINS");
var j :GameObject=assetBundle.Load("WP_Book_Time" ,GameObject);
yield j;
NodeScript.model=j;
}
}
The function expects the full path, not just the “name”. thats likely your error
Hmm, the object is in the root of the assetBundle scene that I am loading in. It has no parents so the full path is just the name.
??
P.S…The asset bundle is a bundled scene and that scene contains the various assets. I’ve tried all sorts of arrangements to the string and setting the object to a prefab in the scene but I can’t get anything to work…
Anyone??
Anyone got any other ideas?
Cheers
So i tried the following…
var instanced :Object;
if(productAssetBundle)
{
print("BUNDLE EXISTS!"+productAssetBundle);
//var j :GameObject=productAssetBundle.Load("WP_Book_Time" ,GameObject);
var j :Object=productAssetBundle.mainAsset;
yield j;
if(j!=null)
{
print("THE OBJECT IS CONTAINED IN THE BUNDLE!! IT WORKED!!!!!");//NEVER PRINTS????
instanced =Instantiate(j);
}
}
But seemingle the object is still not contained within the bundle. Surely every Asset bundle will have a main asset. Is there something I need to do in the assetbundled scene itself?
Okay now this works (ie it prints the contains message BUT the object is not visible in the hierachy window…so in effect it’s useless. Anyone know why I cant see it?
Is the question how do I convert an Object to a GameObject??
var instanced :Object;
if(productAssetBundle)
{
print("BUNDLE EXISTS!"+productAssetBundle);
var j :Object=productAssetBundle.Load("WP_Book_Time",Object);
if(j!=null)
{
print("THE OBJECT IS CONTAINED IN THE BUNDLE!! IT WORKED!!!!!");//NEVER PRINTS????
instanced =Instantiate(j);
}
}
P.S>.all I did was change GameObject to Object…I still don’t understand the super subtle difference??