Author Topic: Problem with Atlas Switching  (Read 2246 times)

Anahit

  • Guest
Problem with Atlas Switching
« on: September 09, 2013, 04:53:59 AM »
I've been attempting to switch out several reference atlases from SD to HD textures at run time.
At run time this has been executing but appears to only be switch out some of the atlases and not others.

I've attempted Resources.FindObjectsOfTypeAll() of 'UIAtlas' and 'UIFont' but this doesn't appear to find all atlases.

I've also attempted Aren's method of holding the ref atlases as gameobject references on the script file, this resulted in all ref atlases being found at runtime but it still would switch only a few of the ref atlases between SD and HD.

Both of these methods where executed at run time within my first scene. I also set the script execution order to be the first to execute.

I've got a feeling the reason why all atlases aren't switching out is due to the fact that not all of them are being referenced within the first game scene that loads.

Other than this I've not got any idea why only a few ref atlases would switch out.

Any help would be greatly appreciated.

Thanks

sisso

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 46
    • View Profile
Re: Problem with Atlas Switching
« Reply #1 on: September 09, 2013, 03:00:46 PM »
Continue digging that you will probably find. Atlas switching works but there is many unity3d and ngui stuff that must be done correctly to really work.

Take a look on this sample, it could help.
https://github.com/sisso/ngui-hdsd

These links could help if you didn't read yet.
http://www.tasharen.com/forum/index.php?topic=832
http://www.tasharen.com/forum/index.php?topic=5591.0

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem with Atlas Switching
« Reply #2 on: September 10, 2013, 07:11:39 AM »
All widgets must be using your reference atlas. Your reference atlas must point to the real atlas. When you want to switch HD to SD, you'd do it in a single place -- the reference atlas. There is no need to find other atlases and fonts.

Anahit

  • Guest
Re: Problem with Atlas Switching
« Reply #3 on: September 11, 2013, 04:38:55 AM »
Thanks Sisso, I had a look over your project and the links, I'm already doing all the things that people are recommending but some of my atlases still aren't setting.

Hi Aren, All my widgets are set to reference atlases. When the project starts I'm getting the path to all my reference atlases and switching in either the 'HD' or 'SD' path. All reference atlases and replacement atlas paths are being found at start up, although only a few of my reference atlases seem to be setting the new path. The items in my first scene all seem to set correctly, but by the time I'm getting in to my second scene I'm noticing that some of the reference atlases aren't set correctly.

When we quit playing the project in Unity, we can see this behaviour clearly on the reference atlasses: not all of them have updated to the correct replacement atlas.


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem with Atlas Switching
« Reply #4 on: September 11, 2013, 07:25:23 AM »
Create a script that references your reference atlases. Don't attempt to load them by path. Make this script DontDestroyOnLoad so that Unity never unloads them. Inside this script's awake, set the reference atlases to point to either HD or SD. That's it.