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

Pages: 1 [2] 3 4
16
Support / Mesh Leak
« on: November 21, 2014, 01:22:36 am »
I seem to have a mesh leak in my game. I noticed that memory wasn't being release between scene changes, and after running the memory profiler, it seems that meshes aren't being destroyed.

Take the following example. Running the memory profiler, it shows that there's 34 meshes in the scene at startup. The game plays for a minute, then reloads the same scene via Application.LoadLevel. The memory profiler now shows 69 meshes. This is even after I do Resources.UnloadUnusedAssets. Am I wrong to expect 34 meshes, since I did a scene reload?

Here's a screen shot of the profile after a scene reload. I really don't know what to make of it, other than here's a ton of nameless meshes, with a lot of references, in memory.



I don't know if this is a problem specific to 2D Toolkit, but since 2D Toolkit sprites and textmeshes are the only objects that use meshes, I figured I'd ask here to rule out any possible known issues with the framework. Feel free to tell me to buzz off if this has nothing to do with the framework! But any help in general is appreciated :)

17
Support / Tiles in tile map appearing in-game, even though deleted
« on: August 09, 2014, 01:47:19 pm »
I have tiles that I've deleted and committed the change from to tile map. The tile doesn't appear in the scene or game view prior to running the editor. However, when I start the game in the editor, the tiles appear. When I stop the game, and it goes away again.

How can I prevent this from happening? I'll sometimes also experience the opposite (tiles that are suppose to remain disappear when running the game).

18
I'll just check for the empty clip when I randomly select. I just wanted to make sure I didn't come across a bug within the framework. Thanks for the quick response!

19
I have a tk2dSpriteAnimator with a collection of tk2dSpriteAnimationClips. For some reason, an empty tk2dSpriteAnimationClip (empty being that the Empty property is true, there are no frames, and the name is empty string) is being inserted into the Library.clips array. Since I randomly choose a clip to play within the library, if this empty clip is selected I receive a DivideByZeroException in tk2dSpriteAnimator, line 686 (
Code: [Select]
int frameId = (int)clipTime % clip.frames.Length;).

Why is an empty clip being inserted into the clips array? I do not have this clip specified in the sprite animation editor.

20
I simply want my camera to be locked on the edges of my TileMap (I don't want to show any empty space). Someone managed to make it work?

I assume then there's no movement code for the camera? If that's the case, you'll just have to fiddle around with the tk2dCamera.ZoomFactor property to get it to show the desirable area of your tilemap. At least that's how I've approached it. You could probably come up with a way to dynamically calculate the zoom but I'm lazy sometimes  :P

21
Support / Re: Rigidbodies falling through tile map mesh colliders
« on: May 31, 2014, 07:44:44 pm »
Doubling the scale (1 to 2) did seem to fix the issue, but now the sprite is double the size which I don't want either.

The sprite is moving fairly slow and I'm not moving it via code so it does seems to be an issue with the scale. I guess I'll have to play around with it to find the optimal scale without having the sprite seem too big (if possible!).

As always, thanks!

22
Support / Rigidbodies falling through tile map mesh colliders
« on: May 31, 2014, 01:12:11 am »
I'm having an issue with rigidbodies easily falling through the mesh colliders of a tile map (not always, but usually). I've read http://2dtoolkit.com/forum/index.php?topic=3039.0 and the recommendation then was simply to use Physics2D, which I did do, but it actually made the problem worse.

I'm curious if there's anything else that can be done? I have the collision detection mode set to Continuous, which according to the Unity docs should detect collision for any static mesh geometry.

23
That's what I was afraid of. Alright, I'll have to get creative then. Thanks for confirming!

24
As the title says, I need to set the renderer material of a particle system to match the current image of a particular tk2dSpriteAnimator. Since the sprite is animated, I have to do this programmatically at run time (I assume).

My initial assumption was that this would be a simple case of syncing up the ParticleSystemRenderer.material with the tk2dSpriteDefinition.material, however tk2dSpriteDefinition.material returns the sprite atlas, which isn't what I want. Browsing the documentation, I don't see any properties that would return the current frame image as a material. So what's my alternative?

25
Support / Re: Any way to increase TileMap.Build performance?
« on: May 04, 2014, 04:24:22 pm »
I'm actually going to go a different route with this. I'm going to create blood splatter prefabs that I'll just pool and position over the tile map, rather than manipulate the tile map directly. The performance is much better and I'll be able to animate the blood splatter as well.

26
Support / Re: Any way to increase TileMap.Build performance?
« on: May 04, 2014, 03:39:28 pm »
I upgraded to 2.5 beta, added a new, smaller tile map to the scene that's sized to overlay the platform tiles on the main tile map.

I'm now getting several of these messages on startup

Destroying object multiple times. Don't use DestroyImmediate on the same object in OnDisable or OnDestroy.
UnityEngine.Object:DestroyImmediate(Object)
tk2dUtil:DestroyImmediate(Object) (at Assets/TK2DROOT/tk2d/Code/tk2dUtil.cs:50)
tk2dRuntime.TileMap.SpriteChunk:DestroyGameData(tk2dTileMap) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapChunks.cs:54)
tk2dRuntime.TileMap.Layer:DestroyGameData(tk2dTileMap) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapChunks.cs:405)
tk2dTileMap:OnDestroy() (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMap.cs:174)

Seems to be one for every chunk in the new tile map.

I also get this message when I try to call SetTile on the smaller tile map

IndexOutOfRangeException: Array index is out of range.
tk2dRuntime.TileMap.Layer.FindChunkAndCoordinate (Int32 x, Int32 y, System.Int32& offset) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapChunks.cs:372)
tk2dRuntime.TileMap.Layer.GetRawTileValue (Int32 x, Int32 y, System.Int32& value) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapChunks.cs:384)
tk2dRuntime.TileMap.Layer.GetTileFlags (Int32 x, Int32 y) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapChunks.cs:428)
tk2dRuntime.TileMap.Layer.SetTile (Int32 x, Int32 y, Int32 tile) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapChunks.cs:450)
tk2dTileMap.SetTile (Int32 x, Int32 y, Int32 layer, Int32 tile) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMap.cs:721)

27
Support / Any way to increase TileMap.Build performance?
« on: May 03, 2014, 10:20:53 pm »
As the title says, other than decreasing the chunk size (I'm currently set to 8x8), is there anything else I can do to help increase the performance of performing a TileMap.Build? I'm currently deploying to Ouya, and there's a bad, noticeable hitch when I call TileMap.Build to change some platformer tiles.

If not, what would be a good alternative to change the look of a tile? When a player dies, I want the tile to get bloody (similar effect to Super Meat Boy). Perhaps overlaying another sprite on the tile, instead of changing it?

28
Support / Re: Tile map layer isn't showing up in standalone build
« on: April 18, 2014, 12:23:14 pm »
Wow, that's very annoying. I messed with the parallax camera depth settings to get it to work. Thanks again.

29
Support / Tile map layer isn't showing up in standalone build
« on: April 17, 2014, 11:23:34 pm »
I have a layer in my tile map that's used with the tk2dParallaxCamera script. In the editor, the layer appears and behaves normally. However, when I run a standalone build, the layer doesn't appear at all. The camera and layer distances should be the same as when running the editor, so I'm really not sure what the problem is. 

30
Okay thanks, that seems to be getting the appropriate numbers.

Based on what you recommended, here is my current solution, but it's not 100% just yet.

Code: [Select]
float scale = 1 / tk2dCamera.ZoomFactor;
Rect newExtents = new Rect(cameraExtents.x * scale,
    cameraExtents.y * scale,
    cameraExtents.width * scale,
    cameraExtents.height * scale);

float clampedX, clampedY;
// To ensure we clamp against both the min and max boundaries,
// We first clamp against the minimum boundaries first.
clampedX = Mathf.Clamp(newExtents.xMin, minXBound.transform.position.x, maxXBound.transform.position.x);
clampedY = Mathf.Clamp(newExtents.yMin, minYBound.transform.position.y, maxYBound.transform.position.y);
// Then clamp against the maximum boundaries.
clampedX = Mathf.Clamp(newExtents.xMax, minXBound.transform.position.x, maxXBound.transform.position.x);
clampedY = Mathf.Clamp(newExtents.yMax, minYBound.transform.position.y, maxYBound.transform.position.y);               

targetPosition = new Vector3(clampedX, clampedY, Distance);

To note, minXBound, minYBound, maxXBound and maxYBound are simply empty GameObjects in my scene that I positioned to represent the bounds in which to keep the camera within; I'm using these because the game area might be smaller than the actual tile map size.

There are a lot of times when the camera should be moving/zooming out to keep a player within view, even when the players are within the appropriate boundaries, but it doesn't. I'll keep messing with it, but please call me out on any glaring issue you might notice.

Edit: It's probably just easier to share my entire camera controller script. Warning: Some of it is ugly! https://gist.github.com/MadballNeek/71af494a096f232c548c

Pages: 1 [2] 3 4