private void loadFlagImage(string path) { byte[] bytes = null; PersistentDataStorage persistentDataStorage = new PersistentDataStorage(Game.ForceVision); if (persistentDataStorage.FileExists(path)) { bytes = persistentDataStorage.LoadBytes(path); } else { StreamingAssetsStorage streamingAssetsStorage = new StreamingAssetsStorage(Game.ForceVision, this); streamingAssetsStorage.LoadStreamingAssetsFile(path, (success, loadedBytes) => { if (string.IsNullOrEmpty(success)) { bytes = loadedBytes; } else { Log.Error("No image flag found for " + path); } }, true); } if (bytes != null && bytes.Length > 0) { Texture2D flagTexture = new Texture2D(4, 4); bool isLoaded = flagTexture.LoadImage(bytes); if (isLoaded) { Flag.sprite = Sprite.Create(flagTexture, new Rect(0, 0, flagTexture.width, flagTexture.height), new Vector2(0, 0)); } } }
public Config() { var loader = new StreamingAssetsStorage(Game.ForceVision, null); loader.LoadStreamingAssetsFile(DefaultConfigFile, OnConfigLoaded, true); }