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 - mrscary

Pages: [1]
1
Support / Re: new sprites are invisible ( or !isVisible ) for two frames
« on: September 06, 2012, 04:24:50 pm »
well it's on scene load that this sprite/fade overlay is visible and then alpha fades away. i.e. frames 1,2,3... Kind of hard to avoid.  I think it'd be the same for a loading screen overlay that you fade away too when the level is finished loading.

right now in ORC, I think this "problem" is covered by the fact that we have some UnloadUnusedAssets and other stuff that's called when the previous scene is still running and somehow, Unity skips frames and it's not apparent.   Our FadeOverlay is a persistent game object which *does* work..  However, every now and then on the first real level load when we instantiate the fade overlay, you can see it.  In this little prototype we're working on, it happens every time, so it's easy to get annoyed by it hehe.

FYI  I tried an FBX mesh that's a quad and rendered to the GUI camera covering the screen.  Same thing.. ( so it's a Unity thing ).  Maybe it's the culling on an orthographic camera or something.

I think the solution is to break down and go back to my GUI.DrawTexture version.. I had tried to eliminate all Unity gui calls from the game, but i think in this case, it won't hurt.

2
Support / new sprites are invisible ( or !isVisible ) for two frames
« on: September 06, 2012, 03:52:50 am »
whether I instantiate a prefab containing a tk2dSprite in code, or drag the prefab into the hierarchy and run the player, or just create a gameObject with a tk2dSprite on it, the tk2dSprite objects are only visible on the 3rd frame... the player on the mac hides the fact that it's not visible, but on an ipad2, you can clearly see when the sprite pops in ( it's a black fade overlay ).

I'm going to assume this is a limitation of Unity?   I'm calling RecalculateBounds() after the mesh is built on the sprite and I've confirmed it's created on the first frame and the bounds are accurate.

This doesn't work so well when you want to display a screen fade overlay.. it pops in after a frame or two.  I've tried a full screen sprite as well as a small sprite.  same thing.

any ideas?

FadeOverlay active: renderer enabled: True bounds: Center: (0.0, 0.0, 0.3), Extents: (1.3, 0.8, 0.0) color: RGBA(1.000, 1.000, 1.000, 1.000) visible: False FrameCount: 1
FadeOverlay active: renderer enabled: True bounds: Center: (0.0, 0.0, 0.3), Extents: (1.3, 0.8, 0.0) color: RGBA(1.000, 1.000, 1.000, 1.000) visible: False FrameCount: 2
FadeOverlay active: renderer enabled: True bounds: Center: (0.0, 0.0, 0.3), Extents: (1.3, 0.8, 0.0) color: RGBA(1.000, 1.000, 1.000, 1.000) visible: True FrameCount: 3

3
Support / Re: Unused atlas textures still loaded after LoadLevel
« on: May 06, 2012, 12:17:13 am »
Yes, dragged into a GameObject slot..  See email for screenshots of the prefab etc ( easier ).

4
Support / Re: Unused atlas textures still loaded after LoadLevel
« on: May 05, 2012, 10:52:40 pm »
Well... I thought Unity would destroy what you instantiate on level changes if no references are left behind?   However, I do explicitly destroy the scene list..and the scene items are children of the scene list.  Debug messages in the scene item's OnDestroy() confirm they are being destroyed.  That said, I added explicit code to destroy these items in the scene list OnDestroy

Code: [Select]
/*
-----------------------
OnDestroy()
-----------------------
*/
void OnDestroy() {
Debug.LogWarning( "UI SCENELIST GETTING DESTROYED &&&&&&&&&&&&&&&&&&&&&&&&&");
itemPrefab = null;
for ( int i = 0; i < listItems.Count; i++ ) {
Destroy( listItems[i] );
}
listItems.Clear();
}

This didn't help.     I have to believe it's the fact that I have a prefab for the scene list gui ( scene list is part of it ), and one of the scene list data fields is another prefab for the scene items.   All that's left from the main menu in the game scene is this stupid scene item prefab..  So I'm going to get rid of that prefab and procedurally create the scene items.  If that fixes it, I will create a test project and submit a bug to unity.   If it doesn't.. well  >:(

5
Support / Re: Unused atlas textures still loaded after LoadLevel
« on: May 05, 2012, 09:20:54 pm »
As far as I can tell, it's just the textures at this point and the materials... which I would guess the materials are keeping the textures loaded.

Sorry.. I re-listed tk2dBaseSprites and the scene menu item prefabs showed up.  I missed those prefabs in the GameObjects list, but verified they are still listed.  All of the Prefabs I use to instantiate gui items are still loaded, even though the objects that instantiate them ( i.e. UISceneList ) are not.

I may try loading these prefabs from Resources as you suggested.  Should they get automatically unloaded on scene changes, or do I have to do something special?

(pseudocode)
GameObject prefab = Resources.Load( prefabNameStr );
for ( int i = 0; i < sceneCount; i++ ) {
   ...instantiate items....
}
Destroy( prefab );  ??  ( i think this will prevent me from loading it again which would happen when I return to the menu )
prefab = null; ??

... or.. just generate the sprites and text procedurally.

6
Support / Re: Unused atlas textures still loaded after LoadLevel
« on: May 05, 2012, 09:05:52 pm »
Well I made it non-static and it's still loaded.

Additionally, there are no longer any references to it in the game object listing.

I'm beginning to wonder if this isn't just another Unity bug:  http://forum.unity3d.com/threads/47858-Forcing-texture-unload

... or perhaps it's because instanced materials from multi atlas collections are leaking?

Code: [Select]
protected override void UpdateMaterial()
{
if (renderer.sharedMaterial != collection.spriteDefinitions[spriteId].material)
renderer.material = collection.spriteDefinitions[spriteId].material;
}

Note.. that ^^ is not it.. i just commented that code out and it made no difference.

7
Support / Re: Unused atlas textures still loaded after LoadLevel
« on: May 05, 2012, 07:47:37 pm »
Even if I loaded it directly from Resources, wouldn't it still hang around level to level if I can't figure out what's keeping a reference to it?

There's this in my UISceneList class

static private UISceneList   thisList = null;

When I first saw that, I thought "there's the problem".  So I clean it up like this:

   /*
   -----------------------
   OnDestroy()
   -----------------------
   */
   void OnDestroy() {
      // this clears the fracking reference to the scene item prefabs that were still in
      // memory because thisList is static
      itemPrefab = null;
      listItems.Clear();
      if ( thisList == this ) {
         thisList = null;
      }
   }

That didn't fix it.. but maybe that class is never getting destroyed :)  I'll investigate some more.. and probably remove the static reference.

thanks

8
Support / Re: Unused atlas textures still loaded after LoadLevel
« on: May 05, 2012, 09:28:03 am »
I found the asset referencing that sprite collection

482. SceneMenuItem collection: MenuBgCollection
483. SceneMenuItem/ActLabel
484. SceneMenuItem/SelectionHighlight collection: MenuBgCollection
485. SceneMenuItem/Shadow collection: MenuBgCollection

This is a prefab of four sprites ( one parent, three children ) that I use to instantiate level selection on our main menu.  So there's a UISceneList script that has a reference to this prefab, then creates a bunch of "scene menu items" from that prefab that are displayed.

So, Unity thinks this prefab should stick around for some reason.  I'll look for static references in the morning.  If that isn't successful, I'll have to find another way to do the menus?


9
Support / Re: Unused atlas textures still loaded after LoadLevel
« on: May 05, 2012, 08:53:23 am »
All four of the TK2dSpriteCollectionData prefabs are still loaded in the game level

4605. data
4606. data
4607. data
4608. data

so something is still addressing that sprite collection.  I think i'll enumerate the game objects looking for tk2dBaseSprite.. when I find them, I'll look for a tk2dSpriteCollectionData matching the one I'm looking for.  I can add a string to the collection data to identify them more easily ( scratch that, I see the sprite collection name is in there already just hidden :) ).

if you have other suggestions, let me know. thanks

10
Support / Re: Unused atlas textures still loaded after LoadLevel
« on: May 05, 2012, 07:53:06 am »
I used something similar to see that the menu atlases were still loaded in the game levels.

-----------------------------------
------- Loaded Textures -----------
-----------------------------------

31. atlas0   1024x1024
32. atlas0   1024x1024
33. atlas0   1024x1024
34. atlas0   1024x1024
35. atlas1   1024x1024
36. atlas2   512x512


the 3 in red ( well at least one of the atlas0's ) is from the menu collection.. definitely atlas 1 and 2 as they are the only textures we have named that.   This snapshot of loaded textures was taken a few seconds after map load and AFTER Resources.UnloadAllUnusedAssets() finished while I waited in a Coroutine checking async to see if it was done. 

I enumerated meshFilters too and then checked the renderers to see if any shared materials were set to atlas2 ( to see what might still have hooks into those textures ) but nothing turned up.  I'll enumerate MeshRenderers and try again.

Update:  enumerating the MeshRenderers and their materials didn't find any matches

enumerating the materials did show:

17. atlas0_material
18. atlas0_material
19. atlas0_material
20. atlas0_material
21. atlas1_material
22. atlas2_material

which are the sprite collection material names

-andrew

11
Support / Unused atlas textures still loaded after LoadLevel
« on: May 05, 2012, 04:40:04 am »
we're seeing a problem where atlases for a sprite collection we use in our main menu are carried into our first level.  we can't afford to load those.  they cause the iPad 1 to crash eventually.

how can we dump those or prevent this from happening?  i'm 99.5% sure we have no references to those collections in the first level ( or any subsequent level )

Oh.. and I should mention I went so far as to load an empty scene in-between scenes, wait while Resources.UnloadAllUnusedAssets() did it's thing and then load my new scene additively.   which is an awful way of having to dump all assets.. ? oh and light probes don't load in LoadLevelAdditive.. so I can't use it anyway.

are there persistent hidden tk2d objects?

thanks

Pages: [1]