Hello Guest

Author Topic: CurrentPlatform - Recommended way to set Platform Specific Sprite Collections  (Read 4135 times)

madclouds

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 17
    • View Profile
Hello,

I was wondering what the suggested way to handle platform specific sprite collections would be.  I went through the tutorial here - http://www.2dtoolkit.com/doc/2.5/advanced/platform_specific_sprite_collections.html - but it doesn't suggest how to select the CurrentPlatform.  Searching the forms, I found this code:

Code: [Select]
Application.targetFrameRate = 60;
 
if(Screen.width > 1136) {
tk2dSystem.CurrentPlatform = "4x";
}
else if( Screen.width > 480 ) {
tk2dSystem.CurrentPlatform = "2x";
}
else {
tk2dSystem.CurrentPlatform = "1x";
}
Debug.Log("CURRENT PLATFORM (main) : " + tk2dSystem.CurrentPlatform );
Debug.Log("Device data:");
Debug.Log("Screen resolution: " + Screen.width + " x " + Screen.height );
 

I saw another technique that monitored the device type and did a string match on the device to set the current platform, but that sounds brittle.

Is checking the Screen.width the best technique?  If so, I'd recommend adding that info to the tutorial page for other people to find.

Thanks for any feedback.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Its up to you, thats why there isn't any guide. You might want 2x sprites when the screen height exceeds a certain amount - the constraints are not set in stone and there isn't one way to do it - it really is up to you what you want to do there.