Hello Guest

Author Topic: Setting tk2dSystem.CurrentPlatform does not change textures used  (Read 5661 times)

tony-jumpthestream

  • Newbie
  • *
  • Posts: 2
    • View Profile
Setting tk2dSystem.CurrentPlatform does not change textures used
« on: December 01, 2012, 10:05:09 am »
Hi

I got version 1.80 + patch 3 from the asset store and have set up a platform specific sprite collection for 1x and 2x. Assets were created fine. When I change the platform through the editor's "2D toolkit > preferences" from "1x" to "2x", the textures used changed from the 1x to 2x as expected.

However, when I use a script in a scene called "Init" to set tk2dSystem.CurrentPlatform from "1x" to "2x" then load the "MainMenu" scene, the textures in the main menu scene are still using "1x":

Code: [Select]
using UnityEngine;
using System.Collections;

public class Init : MonoBehaviour
{
void Awake()
{
Debug.Log(tk2dSystem.CurrentPlatform);  // shows 1x
tk2dSystem.CurrentPlatform = "2x";
Debug.Log(tk2dSystem.CurrentPlatform);  // shows 2x
Application.LoadLevel("MainMenu");
}
}

Am I doing something wrong?

Thanks

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Setting tk2dSystem.CurrentPlatform does not change textures used
« Reply #1 on: December 01, 2012, 07:06:29 pm »
Hi tony -

That should work. Can you please check that CurrentPlatform is correct AFTER mainmenu has loaded? For example, put the debug.log on a script that only exists in MainMenu.

Also, in your startup scene, you don't have any sprites loaded in do you?

tony-jumpthestream

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Setting tk2dSystem.CurrentPlatform does not change textures used
« Reply #2 on: December 03, 2012, 10:52:54 am »
Hi Unikron

After mainmenu has loaded, tk2dSystem.CurrentPlatform prints "2x", but the textures are still using "1x"

At the startup scene called "Init", no sprites are loaded. I also tried having a sprite in the startup scene, but the same thing still happens.

My Unity3D version is 3.5.6f4

Thanks
-Tony


unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Setting tk2dSystem.CurrentPlatform does not change textures used
« Reply #3 on: December 03, 2012, 08:49:31 pm »
Hmm. This should work (and definitely works on my tests here). The only reason this is likely to break is if the sprite collection is already resident in memory before the platform is set.

Drop me an email and we'll go through some more troubleshooting in more detail. (support@unikronsoftware.com)