Exemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        AssetBundle ab = null;

        string path = "" + Application.dataPath + "/example/bundle/item.unity3d";

        if (FileLoader.IsExist(path))
        {
            byte[] data = FileLoader.ReadAllBytes(path);
            ab = AssetBundleLoader.CreateFromMemoryImmediate(data);
            GameObject.Instantiate(ab.mainAsset);
        }

        path = "" + Application.dataPath + "/example/bundle/Button.unity3d";
        if (FileLoader.IsExist(path))
        {
            byte[] data = FileLoader.ReadAllBytes(path);
            ab = AssetBundleLoader.CreateFromMemoryImmediate(data);
            GameObject.Instantiate(ab.mainAsset);
        }

        path = "" + Application.dataPath + "/example/bundle/Terrain.unity3d";
        if (FileLoader.IsExist(path))
        {
            byte[] data = FileLoader.ReadAllBytes(path);
            ab = AssetBundleLoader.CreateFromMemoryImmediate(data);
            GameObject.Instantiate(ab.mainAsset);
        }
    }
    //finish callback
    private void finish_callback(string name, byte[] res)
    {
        AssetBundle ab = AssetBundleLoader.CreateFromMemoryImmediate(res);

        GameObject.Instantiate(ab.mainAsset);
    }