Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - sebastian

Pages: [1]
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!

2
Support / Re: platform sprites still loading into ram
« on: August 22, 2014, 11:39:58 pm »
It worked!!!

Hooray!  So just as you suggested, when I built in Xcode, ONLY the platform specific sprites showed up :).

Loads fine now on the 4s!

So the question is-- what the heck was I doing wrong before??

I think there are four possibilities?

1)  There is a *chance* that maybe I only tested 4s with 2x.  I can't imagine why I would only do that-- but my memory's a little fuzzy on it now.  But 2x makes it crash.  Only going down to 1x gets it to run.  So if I initially was stupid and didn't check 1x that would explain the crash.  I think I did check 1x though???  I can't remember. :(

2)  In my successful test, I built 1x and it worked on 4s.  I then switched to 2x and it crashed.  I switched back to 1x and it crashed again!  I then went into tk2d preferences and changed the default editor platform to 1x.  This time at 1x it worked again.  Tried again to make sure and it's running fine.  I'm not sure if changing the default platform to 1x actually helped-- in my experience the 4s has so little ram that sometimes it just chokes randomly if you've pushed the device too much without a restart.  So maybe switching tk2d preferences to default 1x had an effect-- though I suspect maybe the phone just glitched out.

3)  The only other real thing I did is when you asked me to print the textures showing up, I noticed all the platform specific atlases were defaulting to the same name: atlas0.  1x, 2x and 4x sprites were all called atlas0.  So I manually changed the names of those atlases so I could see what was happening in debug.  (i.e. I changed to myatlas01_1x, myatlas01_2x, myatlas01_4x).  I have no idea whether that had an impact or not.  Could tk2d have confused the atlases if they were all called atlas0??  I doubt it cuz it looks like it's all folder based.  But anyway, that's something I did and now it's working.

4)  Most likely-- I did something stupid and I'm not sure what. lol  I am prone to doing dumb stuff-- so maybe there was some script of mine that I screwed up on and subsequently got rid of between crash and success?  I am certain that the 4s was originally crashing due to memory pressure.  that was the Xcode error.  Anyhow, it is definitely possible  that some dumb script of mine was responsible for the error.

Anyway, it's all working now!  Sucks that I'm still a little fuzzy as to why it's working now and wasn't before?  But mainly I'm grateful to have it running!!

Thank you so much, Unikron for your awesome software and support!!  I'm heading over to the asset store now to amend my already very positive review to make it more positive.

Thanks again.  I'm super grateful for all of your help.

Sebastian
(funAsylum on asset store)

3
Support / Re: platform sprites still loading into ram
« on: August 22, 2014, 09:41:45 pm »
Oh okay sorry I misunderstood.  Yes I was testing in editor.  I'll build now and report back..

Sorry for that!!
Thank you!!

4
Support / Re: platform sprites still loading into ram
« on: August 22, 2014, 09:21:29 pm »
Ah okay-- that's very helpful!

What I'm seeing is that actually, despite what platform I set in startup, and indeed in a pre startup blank scene, all THREE texture sizes are actually showing up in debug using Resources.Find per your suggestion-- @1x, @2x and @4x.

So it looks like all three versions are hitting ram.  I tested setting different platforms at startup, and also tested changing the tk2d platform in editor preferences with the same result.

Definitely explains my crash.  Btw I'm using Unity 4.5.2f1

Thanks for your help!!
Sebastian

5
Support / platform sprites still loading into ram
« on: August 22, 2014, 01:56:29 am »
Thanks for all of your help Unikron.  Unfortunately have another question for you...

I've been trying to implement platforms on tk2d but my app still crashes cuz of memory pressure at startup on my nemesis, the iphone4s.

My platform setup and @2x and @1x textures work fine in the Unity3d editor. Textures switch great.

However, since the iphone4s is still crashing on me cuz of memory pressure when building in Xcode, I am fairly certain that somehow my larger textures must be getting loaded into RAM at startup-- despite the platform setting.

I suspect this is case because:

A) before implementing platforms, as a test I manually changed all of my tk2d atlas compression to 16bit from 32 and it loaded fine on the iphone4s

B)  i then implemented platforms which by my calculations should be much much smaller than simply changing from 32 to 16 (in fact my 2x and 1x textures are ALSO set to 16bits as well as being physically smaller)

C)  I'm certain I'm switching the tk2d platform before a single sprite loads.  I even went so far as to add a blank scene to the very start of my app that ONLY has: tk2dSystem.CurrentPlatform = "1x";
My debug verifies that I am indeed using the 1x platform at the very start of loading.

However I'm still getting memory crashes on startup.

Could this be because I *started* my sprites with a default size of 4x?

So maybe the default 4x has to load initially before then switching down to 1x?

I'd clarify that while some of my tk2d sprites are being loaded as prefabs, some are just sitting in my scene #2 hierarchy.  So I'm assuming maybe those 4x textures load and hit ram somehow before getting a chance to switch to 1x?

Thanks very much for your great support and ongoing help!!

Sebastian

6
Support / Re: platform specific compression swap
« on: August 21, 2014, 06:15:33 pm »
Okay thank you-- that is definitely helpful!

That is the only place where the scale is set at a master level, correct?

I had been wrestling with the idea of trying to make all my sprites start with default @1x when I currently have everything sized properly to start with @4x.

However seeing this, it seems I could keep all my sprite scaling in my game, replace my tk2d default sprites with the @1x assets, and then make the scale of the @1x .25f for instance.  Then @2x would be .5f and @4x would be @1f.

You think that could work to swap @1x and @4x default sprites?

Thank you!

7
Support / platform specific compression swap
« on: August 20, 2014, 08:47:25 pm »
Hi Unikron--

Thanks agin for your awesome toolset.  Apologies for my latest string of questions-- I'm implementing platforms and want to make sure I get it right.

I've had success implementing @2x and @1x platform sprites starting with a @4x default.  However I have some sprite sets where the quality is just too poor to use smaller sprites.  I had a thought that maybe I could use the same sized artwork for my @2x and @1x platform sets, but then change the compression setting of the atlas texture afterwards to still get some platform specific mb savings.

When I tried this, the @2x and @1x sprites were out of alignment in gameplay.  It seems that tk2d is automatically resizing/reposition platform sprites even if the artwork is actually the same size?

If this is the case, is there a way to accomplish what I'm trying to do-- have an identically sized atlas for a different platform that is just set to a different compression setting?

The goal would be to load the platform specific compressed atlas at startup to save on mb for those older devices.

Thanks for any thoughts!
Sebastian

8
Support / Re: too many textures for atlas size when adding platforms
« on: August 20, 2014, 06:02:36 am »
Okay I answered my own question-- I think.

Turns out when I resized my textures in photoshop, I guess it left some sort of non zero alpha edge around the entire border of the texture.  so tk2d wasn't trimming the images since it saw this edge and basically interpreted each image as a big box.

So even though my artwork was smaller, since it was trying to pack the whole canvas of the art, it ended up being larger.

I'm currently going back into photoshop and cropping 2 pixels off the edges and that seems to be doing the trick.

Thanks.



9
Support / too many textures for atlas size when adding platforms
« on: August 20, 2014, 04:52:56 am »
Hi-- had a follow up question on adding platforms.

I had everything working perfectly with large resolution textures in tk2d.

Now I realize I need some lower rez platform specific sprites and am implementing @2x and @1x textures.

However, when trying to commit some of these tk2d collections I'm suddenly getting "Unable to fit textures in requested atlas area.  There are too many textures in this collection for the requested atlas size."

Can you explain to me why this would be?  Odd given that the large platform sprite sheets built and worked fine.

I've found that if I add dicing to my sprites I can work around this error.  However, I'd like to avoid dicing if possible-- plus everything was all set up and working nicely at @4x.

Is there a reason that adding smaller resolution platforms with smaller textures requires dicing to fit, while the large textures fit fine without the smaller platforms?

Thank you for your help!
Sebastian

10
Oh okay-- perfect!  Even better.

I very much appreciate the quick support and help!!

Thank you!

11
Okay I figured out what I was doing dumb:

I had created new textures (i.e. myTexture@x1  and myTexture@x2) but had mistakenly thought I needed to drag those into the tk2d sprite editor window and commit to rebuild-- so I was making entirely new sprites, not new platform sprites.

A followup question:  What is best practice for file management if I'm starting with 4x textures?

ie-- my workflow is:

1)  got all my tk2d sprites and sprite animators working fine with large textures just called "myTexture"

2)  now I realize I need other platforms-- specifically 1x and 2x

3)  i've added @1x and @2x textures to the same folder as myTexture so that the folder now has:
myTexture
myTexture@1x
myTexture@2x

4)  I'm assuming since in tk2d editor I'm setting the 'current' platform to 4x, that I need an @4x in there somewhere.  So is the proper workflow:

A)  duplicate the myTexture so the folder has 4 items (myTexture, myTexture@4x, myTexture@2x, myTexture@1x)

or

B) just rename the original texture so the folder has 3 items (myTexture@4x, myTexture@2x, myTexture@1x)

Thanks for your help!!
Sebastian

12
Okay thank you very much!  I'll see if I can figure out what's going on with the Anim collection and will follow up with more questions if needed.

Thanks very much again!

13
Sorry I also had one more related follow up question--  does tk2d platform functionality swap the loaded platform specific sprites after loading?  Or does it determine which platform sprites to use before loading anything into memory?

The issue I'm trying to overcome in my app is too many mb being loaded at startup.

thanks for any clarification!

14
Hey there--

So late in the game I've decided I needed to implement tk2d platforms.  What an AMAZING feature-- thank you-- it's really gonna save my butt for getting my app to run on older devices.

However, in early tests I've found that adding platforms to my sprite collections then gives me a "An invalid sprite collection has been found in the selected clip. Please correct this in the inspector" error when I load tk2d SpriteAnimations that reference the original clips.

I'm not seeing how to 'correct this in the inspector'.  I've tried dragging the new sprite collection prefabs into the animation window-- restarting unity-- rebuilding the tk2d index... 

Is there a workflow for this error?  I have a ton of spriteAnimations already built so I'm really hoping I don't need to recreate them all with the new platform specific sprites...

Thanks for your help!
Sebastian

15
Support / Re: Atlas creation and memory problems
« on: October 15, 2012, 10:32:18 pm »
Just wanted to say I had a similar problem when I had a bad crash and a lot of my tk2d sprites got disconnected.  When restarting my project it would reimport all my assets-- and would cause unity to crash every time (Fatal Error Could Not allocate memory).

Turns out a solution that worked for me was to close unity, then remove my TEXTURES folder from my unity project.  Reopen Unity, then drag my textures back into the texture folder one by one.

I guess Unity was choking trying to reimport all of my textures at once.  Doing it a few at a time worked.

Hope someone else finds this helpful!

Pages: [1]