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.


Topics - Velvety

Pages: [1]
1
Hi,

I am running into the same issue explained here: http://2dtoolkit.com/forum/index.php/topic,1756.msg8564.html.  Basically I have an isometric game with 2dToolkit with lots of overlapping buildings and troops, each set with a different draw layer to ensure they draw in the correct order so it looks isometric.  Even with all the buildings in 1 sprite atlas and no troops showing up I can get around 70 draw calls because (I think) the various overlapping sprites are all set to different draw orders.  Is that correct?

Am I doing something wrong, or is this just the nature of how it works?

Are there any ways to help reduce the draw calls for something like this?

2
Support / Layout prefabs in UI_demo are missing a mono script?
« on: October 02, 2013, 08:08:55 pm »
I have v2.2 and I'm going through the UI tutorial for the first time trying to use BasicButtons with a layout.

When I drag the BasicButton prefab (or any layout prefab it seems) from TK2DROOT/tk2dUIdemo/ControlPrefabs/Layout into my scene it has a missing mono script on it.  Also the parent Tk2dUILayoutContainerSizer does not recognize it (this is probably related).

What is the missing Tk2d script that needs to be attached to the layout button?

Thanks

3
Support / Creating a sprite from code question
« on: September 18, 2013, 04:24:38 pm »
Hi,

I'm looking at ways that I can dynamically create a bunch of sprites when my game loads.  Ideally I want to be able to load a JSON or XML file from the network with a bunch of sprite configs that get dynamically instantiated into my game scene when it loads.

I've read your FAQ (http://unikronsoftware.com/2dtoolkit/forum/index.php/topic,24.msg24.html#msg24) that mentions "If you need to generate large numbers of sprites by name, simply create one prefab for your sprite collection, instantiate it, and use GetSpriteIdByName() and switch the sprite. This way, you can pool one sprite type per Sprite Collection, and instantiate them the way you need it." 

This makes sense and currently seems to be the only way to handle doing what I want.  However, I'm curious if there is a way to create only 1 prefab with 1 sprite collection set (instead of having 1 prefab for every possible sprite collection) and then I can change the sprite collection using SetSprite().  To do this i would need a list of all the available sprite collections as accessible tk2dSpriteCollectionData objects.  I can not currently find a way to determine what all the available sprite collections are.

tk2dSystem seems to have a possible variable "allResourceEntries" that may be useful, but this is not accessible and I'm not sure if it is even useful for my needs.  Is there any way you can think of that would provide me with a static list of all the sprite collections?

4
Support / sprite SortingOrder max layer?
« on: September 13, 2013, 05:01:12 pm »
I'm using 2D Toolkit to render my own isometric tiled map with tk2dSprites.  Drawing tiles in the correct order for isometric maps is very important for making sure it looks correct.  I am using the sprite's SortingOrder to do this, however it seems that any number higher than about 5000 makes the sprite disappear completely.   A SortingOrder of 4000 works fine.

My isometric tiled map has up to 26000 tiles and so up to 26000 render layers.  How come the support for SortingOrder seems to cut off around 5000?  Is this a bug or an intentional restriction?

The new editor variable for this is labelled "Sorting Order In Layer" does that mean I can group sprites into Unity Layers for further draw order control?  Or does that have to be done via Z axis manipulation?

5
Support / tk2dCamera.ScreenExtents incorrect when ZoomFactor not 1?
« on: August 21, 2013, 05:20:46 am »
I'm not sure if I am missing something here or if there is actually a problem.  I am changing my tk2dCamera.ZoomFactor to zoom in and out of my scene. This works fine.  I am also moving my tk2dCamera position around to pan the scene.  This also works fine.

But when I use tk2dCamera.ScreenExtents to keep the camera within a bounds I am running into a problem.  tk2dCamera.ScreenExtents seem to be correct when my ZoomFactor is 1.  However, when I zoom in or out (ZoomFactor becomes something like 0.625 or 1.25, etc) the tk2dCamera.ScreenExtents no longer seems accurate and my bounds are not restrained correctly.

I've tested this by creating a cube with the same size of the ScreenExtents and positioning it center with the camera. At ZoomFactor 1 the tk2dCamera.ScreenExtents returns 16 width x 12 height and a cube of the same size matches the camera bounds I see in the editor's scene view.  But if my ZoomFactor is 0.625 tk2dCamera.ScreenExtents returns 21.33 width x 16 height and this does NOT match a cube of the same size.  A cube closer to 25.6 x 19.2 looks accurate.

Am I missing something fundamental here or is tk2dCamera.ScreenExtents not returning the actual correct size of the camera bounds?

6
Support / How to set draw/render layer of sprites?
« on: August 18, 2013, 11:26:29 pm »
Hi,

I've recently started using 2DToolkit.  I am converting an older code base of mine that used Sprite Manager 2.  I'm trying to figure out how to render sprites ontop/behind each other with 2DToolkit without manually setting the z position of the sprite transforms.  SM2 had a "drawlayer" property to handle this on its sprites.  I see in your script reference that the tk2dSprite class is supposed to have a RenderLayer property that sounds like it would do the same thing.  However, this property does not actually exist in that class when I look.  How come it is missing?  Is there some other way to handle the order that sprites are rendered in?

Thanks, really liking 2DToolkit so far.

Pages: [1]