Multiple TileSets won't work with streamingAssets

Create issue
Issue #43 resolved
Nitneroc created an issue

You can reproduce this easily : I just took small_tests_multiple_tilesets and associated tilesets and put it in StreamingAssets. The map isn't loading correctly, when it's loading correctly from regular assets.

Comments (3)

  1. Nitneroc reporter

    This was because loading through www does not set texture name. You have to do it manually. I had to change LoadTileSetManually inside TileSet.cs, to add

    TileSetImages[index].Texture.name = Path.GetFileNameWithoutExtension(path);
    

    after loading the texture. BTW, i also added point filtering to the texture :

    TileSetImages[index].Texture.filterMode = FilterMode.Point;
    

    And I read somewhere that www.texture might be less efficient than www.LoadImageIntoTexture, so I changed that too. Here is the updated method :

    IEnumerator LoadTileSetTexture(string path, int index)
            {
                TileSetImages[index].Texture = new Texture2D(1, 1, TextureFormat.RGBA32, false);
                WWW www = new WWW(path);
                yield return www;
                www.LoadImageIntoTexture(TileSetImages[index].Texture);
                TileSetImages[index].Texture.name = Path.GetFileNameWithoutExtension(path);
                TileSetImages[index].Texture.filterMode = FilterMode.Point;
                //TileSetImages[index].Texture.
                OnFinishedLoadingTexture();
                //BuildTiles(mapTileWidth);
            }
    
  2. Guilherme Augusto Almeida Filo Maia repo owner
    • changed status to open

    Thanks for catching this bug. I assume I didn't test this feature very well...

  3. Log in to comment