1
Support / Re: platform sprites still loading into ram
« on: August 23, 2014, 04:30:11 pm »
Hey so I think I finally figured out what was going on...
In my game I actually load three scenes. Scene 1 is just a blank scene with a single change tk2d platforms command. Scene 2 is a preloader with a simple load bar. And Scene 3 is the game with all the assets.
I realized that I had actually put some prefabs directly in the preloader hierarchy (i.e. Scene 2) that I had turned off and completely forgotten about. These preload elements had references to quite a few sprite sheets. These were the culprits!
I found that the sprite sheets for just those forgotten elements were double loading-- i.e. would load both @4x and @1x elements.
A few things I learned just in case anyone else is reading and potentially runs into a similar issue:
1. Even though I changed tk2d platforms in an entirely blank scene before switching to the preload scene, tk2d did not switch platforms QUICK ENOUGH to avoid the instant load of scene2 and the hidden assets hitting RAM. I'm sure if I had waited even .25f seconds it would have been fine, but scene2 loaded right away after scene1, and so the switch didn't happen in time.
2. The default tk2d platform set in editor is important because it is the INITIAL STARTING platform that's used before any manual switch happens. So even though I had a blank scene switching platforms to 1x, tk2d started up in 4x and the assets I'd forgotten about in scene 2 started in 4x before getting a chance to switch
3. Hidden assets could be the problem: One reason I was stumped for so long is because I had this blank scene at startup switching tk2d platforms. I was under the impression that I was switching platforms way before any assets appeared in my game (i.e. before the preloader even). I had forgotten all about some offed prefabs in the preloader hierarchy (my game has 72 levels and a ton of stuff flying around-- so I forgive myself lol). Anyway, I didn't consider that any assets could have hit RAM before my initial switch platform command cuz I wasn't aware of those assets! Also, even switching to an entirely new scene didn't create enough of a delay between tk2d platform switch and assets sitting in hierarchy of the next scene for the platform to switch in time. This, of course, was the point of my preloader-- to stagger the load. But the forgotten assets didn't benefit from this time/load management
Anyway-- thanks very much again, Unikron! Everything is working great now!
In my game I actually load three scenes. Scene 1 is just a blank scene with a single change tk2d platforms command. Scene 2 is a preloader with a simple load bar. And Scene 3 is the game with all the assets.
I realized that I had actually put some prefabs directly in the preloader hierarchy (i.e. Scene 2) that I had turned off and completely forgotten about. These preload elements had references to quite a few sprite sheets. These were the culprits!
I found that the sprite sheets for just those forgotten elements were double loading-- i.e. would load both @4x and @1x elements.
A few things I learned just in case anyone else is reading and potentially runs into a similar issue:
1. Even though I changed tk2d platforms in an entirely blank scene before switching to the preload scene, tk2d did not switch platforms QUICK ENOUGH to avoid the instant load of scene2 and the hidden assets hitting RAM. I'm sure if I had waited even .25f seconds it would have been fine, but scene2 loaded right away after scene1, and so the switch didn't happen in time.
2. The default tk2d platform set in editor is important because it is the INITIAL STARTING platform that's used before any manual switch happens. So even though I had a blank scene switching platforms to 1x, tk2d started up in 4x and the assets I'd forgotten about in scene 2 started in 4x before getting a chance to switch
3. Hidden assets could be the problem: One reason I was stumped for so long is because I had this blank scene at startup switching tk2d platforms. I was under the impression that I was switching platforms way before any assets appeared in my game (i.e. before the preloader even). I had forgotten all about some offed prefabs in the preloader hierarchy (my game has 72 levels and a ton of stuff flying around-- so I forgive myself lol). Anyway, I didn't consider that any assets could have hit RAM before my initial switch platform command cuz I wasn't aware of those assets! Also, even switching to an entirely new scene didn't create enough of a delay between tk2d platform switch and assets sitting in hierarchy of the next scene for the platform to switch in time. This, of course, was the point of my preloader-- to stagger the load. But the forgotten assets didn't benefit from this time/load management
Anyway-- thanks very much again, Unikron! Everything is working great now!