Exemplo n.º 1
0
    public static SpriteAtlas LoadSpriteAtlas(string tag)
    {
        var saab = AssetBundle.LoadFromFile(PlatformPath.StreamingPath(tag.ToLower()));
        var sa   = saab.LoadAsset <SpriteAtlas>(tag);

        print("loaded " + tag + ":" + sa + " " + Time.frameCount);
        map.Add(tag, sa);
        return(sa);
    }
Exemplo n.º 2
0
    private IEnumerator DoLoadAsset(float delay)
    {
        yield return(new WaitForSeconds(delay));

        var ab = AssetBundle.LoadFromFile(PlatformPath.StreamingPath("canvas"));
        var go = ab.LoadAsset <GameObject>("canvas");

        print("loaded canvas " + Time.frameCount);
        GameObject.Instantiate <GameObject>(go);
        print("instance canvas " + Time.frameCount);
    }
Exemplo n.º 3
0
    private IEnumerator DoLoadAsset(Action <SpriteAtlas> action, string tag)
    {
        yield return(new WaitForSeconds(3));

        var ab = AssetBundle.LoadFromFileAsync(PlatformPath.StreamingPath(tag.ToLower()));

        yield return(ab);

        print("DoloadAsset frame:" + Time.frameCount);
        var sa = ab.assetBundle.LoadAsset <SpriteAtlas>(tag);

        print("sa: " + sa);
        action(sa);
    }
Exemplo n.º 4
0
    private static AssetBundle LoadAB(string abpath)
    {
        string path = PlatformPath.StreamingPath(abpath);

        return(AssetBundle.LoadFromFile(path));
    }