2D Toolkit Forum
2D Toolkit => Support => Topic started by: ricke on August 13, 2016, 10:24:31 pm
-
So I'm working on a space shooter game with 2D Toolkit 2.5.6 and I'm trying to setup multi-resolution sprite collections as the docs below explain. I initially tried to setup in my game, but due to my issues, I created a test project to hammer it out. Unfortunately, I've gotten the same results in both projects. :(
http://www.2dtoolkit.com/doc/2.5/advanced/platform_specific_sprite_collections.html (http://www.2dtoolkit.com/doc/2.5/advanced/platform_specific_sprite_collections.html)
I want my game to run natively at 1920 x 1080, so I set my Current Platform to 4x and then added 1x and 2x platforms in the sprite collection settings. My sprite sizes are 64 x 64 (4x), 32 x 32 (2x), and 16 x 16 (1x). It appears to be generating the proper 1x, 2x, and 4x atlases in the Project directory, so that looks good. However, I always seem to be getting the 1x version of the sprites, no matter which resolution I select on the Game screen. I've looked around on the forums and it seems like I'm doing the right thing, but I've got to be missing something. :)
In the example project, I'm spinning up a GameController object that sets the CurrentPlatform in the Awake method, then I create an instance of a prefab of my Ship, Enemy, and Shot in the Start method. Here's the code for my GameController:
using UnityEngine;
using System.Collections;
public class GameController : MonoBehaviour
{
public GameObject playerPrefab;
public GameObject enemyPrefab;
public GameObject shotPrefab;
private GameObject _player;
private GameObject _enemy;
private GameObject _shot;
void Awake()
{
if (Screen.height >= 900)
{
tk2dSystem.CurrentPlatform = "4x";
}
else if (Screen.height >= 480)
{
tk2dSystem.CurrentPlatform = "2x";
}
else
tk2dSystem.CurrentPlatform = "1x";
}
void Start()
{
// Create new instances of sprites
_player = Instantiate<GameObject>(playerPrefab);
_enemy = Instantiate<GameObject>(enemyPrefab);
_shot = Instantiate<GameObject>(shotPrefab);
Debug.Log("Current Platform: " + tk2dSystem.CurrentPlatform);
Debug.Log("Screen Resolution: " + Screen.width + " x " + Screen.height);
}
}
Here's a screenshot with my enemy texture at 1x, 2x, and 4x respectively above my ship, enemy, and shot sprite prefabs to show the difference. No matter what Preview resolution I use in the Game window, the sprites are always the 1x size.
(http://i.imgur.com/i82IIzl.png)
I can send my example project along if that would be helpful. Any thoughts would be appreciated. Thanks.
-
Yes please post a repro in the private support forum.