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

Pages: 1 [2] 3
Releases / Re: 2D Toolkit 2.3.3
« on: December 20, 2013, 06:33:35 pm »
What version did you update from? From what I can see this hasn't changed in a long long time.
We updated from 2.3.0 and using Unity 4.3.1f1, also I tested the clip switching in a separate project. The problem remains for some reason.

Do you have any idea what can cause such behaviour? It looks like some state inside of Sprite Animator went mad.

Releases / Re: 2D Toolkit 2.3.3
« on: December 18, 2013, 11:43:15 am »
Another issue: I can't switch the clips from editor on the fly anymore (inside Sprite Animator). It just plays the clip that was selected when scene started to play.

I tested it for an animation with a low frame rate: when switching, the animation shows a new clip for a moment and then returns to the previously selected.

upd: I also can't change Anim Lib property.
If I start with "once" clip, I can select another animations, but they will not play. If I start with a looped clip, it will stuck and prevent editor from switching to other animations.

Releases / Re: 2D Toolkit 2.3.3
« on: December 17, 2013, 09:39:33 am »
It could be that unity bug where the editor window position gets corrupted. You can reset this by Reverting to factory layout in Unity to see if that helps.
Yep, it was layout bug! Thank you.

Releases / Re: 2D Toolkit 2.3.3
« on: December 16, 2013, 03:45:19 pm »
For some reason I can't open Sprite Animation Editor after update. The "Open Editor" button just does nothing in all my projects.

Releases / Re: 2D Toolkit 2.3 beta 1
« on: November 10, 2013, 07:54:09 am »
Default pixels per meter is now 100 to work better with Unity
Are there any downsides of using 1 pixel per meter?

Support / Re: Best way to rotate sprites?
« on: August 20, 2013, 01:35:22 pm »
Thanks, but it didn't work either.  :(

Here's my full code:
Code: [Select]
tk2dStaticSpriteBatcher batcher = new GameObject().AddComponent<tk2dStaticSpriteBatcher>();
batcher.batchedSprites = new tk2dBatchedSprite[1];

tk2dBatchedSprite batchedSprite = new tk2dBatchedSprite();

batchedSprite.spriteCollection = spriteCollectionData;
batchedSprite.spriteId = spriteID;

Vector3 pos = new Vector3(100, 100, 0);
batchedSprite.relativeMatrix.SetTRS(pos, Quaternion.identity, Vector3.one);
batcher.batchedSprites[0] = batchedSprite;

//batchedSprite.rotation = Quaternion.AngleAxis(90, Vector3.forward);
batchedSprite.rotation = Quaternion.Euler(0, 0, 90);

batcher.SetFlag(tk2dStaticSpriteBatcher.Flags.GenerateCollider, false);

Support / Re: Best way to rotate sprites?
« on: August 20, 2013, 12:40:49 pm »
How can I rotate a batched sprite for some angle?

I'm trying
Code: [Select]
batchedSprite.rotation = Quaternion.AngleAxis(90, Vector3.forward); before building a batch but it doesn't work.

So, I'm moving all my batch-related collections to a "Resources" folder inside "scName Data" folders and loading them later. Is it a proper way to get a sprite collection before creating a batch from its sprites?

Code: [Select]
GameObject go = Resources.Load("my_sc_data_inside_resources_folder") as GameObject;
tk2dSpriteCollectionData spriteCollectionData = go.GetComponent<tk2dSpriteCollectionData>();
And then I use code from the documentation.

Support / Re: Clarifying different devices and resolutions support
« on: July 05, 2013, 01:54:42 pm »
Thanks! I'm still a huge noob in Unity.  ::)

Support / Re: Clarifying different devices and resolutions support
« on: July 05, 2013, 10:12:52 am »
When I'm overriding with a smaller or larger resolution (e.g. 960x640), my sprites are still using the native one (480x320) for positioning.

So I'm getting an input of (900; 600) near the top right corner, but my top right sprite assumes it position is (450; 300). If I knew the scale, I would divide my input by it.

Sorry, I can't get what the screen extents are for.  :/
Returns screen extents - top, bottom, left and right will be the extent of the screen
Regardless of resolution or override

I got x:-19.8 y:480 w:360 h:-480 for native resolution 384x512 scaled up too 600x800 screen.

Support / Re: Clarifying different devices and resolutions support
« on: July 05, 2013, 08:38:53 am »
Well, I defeated the problem.  8)

Step 0: add wildcard "fit visible" override to your camera
Step 1: find the aspect ratio
Step 2: set camera's native resolution for this aspect ratio (mine are 480x320 3:2, 512x384 4:3, 568x320 16:9, etc.)
Step 3: choose 1x/2x/4x by looking at device resolution

I hope, the very last question: where can I get the camera's current scale ratio to match the input? There's "scale" in UpdateCameraMatrix() but it can't be accessed outside the function.

Support / Re: Clarifying different devices and resolutions support
« on: June 16, 2013, 10:05:17 am »
I'm using MultiPlatfrom Toolkit and want my game to work on all popular aspect ratios: 3:2, 4:3, 5:3, 16:9, 16:10.

I have multiple sprite collections:
* 4x (2048x1536 iPad retina and other very large resolutions)
* 2x (1024x768, 960x640, 800x480 and other popular medium resolutions)
* 1x (480x320 old devices)

For resolutions "between" 4x and 2x (or 2x and 1x) I will scale down larger assets with tk2dCamera override (for example, 4x assets which are pixel perfect at 2048x1536 will be scaled down for 1600x900).

My immovable backgrounds (like menu background) will be large for preventing letterboxes at different aspect ratios. And for movable backgrounds like game field I'll just show more content (it's a top-down game). GUI is anchored to screen corners.

I see overall algorithm like this:
  • detect an aspect ratio of the device
  • detect resolution
  • choose 4x, 2x or 1x assets depending on resolution (tk2dSystem.CurrentPlatform)
  • choose right camera to have right scaling for current resolution and aspect ratio

I was thinking about multiple cameras because of different native resolutions for different sprite collections. But I also have different aspect ratios and complicated situations like "fit camera with 4:3 native resolution in a smaller resolution with 16:9 aspect ratio" when I can't use pixel perfect override (because sprites will be too large) or fit visible override (because some content will be cropped).

My main task is to make an adaptive design that will fit all 6 popular aspect ratios by:
* choosing right sprite collection
* scaling sprites down if it's not "native resolution"
* anchoring GUI elements
* showing different amounts of game content

Support / Re: Clarifying different devices and resolutions support
« on: June 15, 2013, 09:39:38 pm »
Sorry, more questions arised.  ::)

1. If my artwork is pixel perfect for 1136x480, 960x480 and multiple other resolutions, which one should I write in "Native resolution" fields?

2. If I have 1x, 2x and 4x assets, should I use 3 different cameras for them?

Support / Re: Clarifying different devices and resolutions support
« on: June 09, 2013, 07:56:56 pm »
Thank you! Got it except for resizing.

Let's say I have only 1024x768 background in my assets and want to show it on 640x480 screen without creating smaller assets or mipmaps. Could I achieve it with tk2dCamera override? (I'm now playing with its settings, but can't get this kind of scale.)

And is it possible to exclude 2x/4x assets from some builds? Maybe with help from Multiplatform Toolkit?

Support / Clarifying different devices and resolutions support
« on: June 09, 2013, 11:50:58 am »
Sorry for another-one-resolution-thread, but I'm still confused after reading previous ones.

I'm migrating from cocos2d-iPhone where I used 3 sets of sprite atlases:
  • 1x: old iPhones 480x320
  • 2x: iPhones w/ retina 960x640, iPhone 5 1136x640, old iPads 1024x768
  • 4x: iPads w/ retina 2048x1536

Cocos2d has "points": one point equals 1 pixel on an old non-retina screen and 2 points on a new retina screen. So, iPhone/iPod touch screen size is always 480x320 points (568x320 for iPhone 5) and iPad screen size is 1024x768 point, regardless of DPI. All assets for iOS games were made 4x for iPad retina (with common divisor 8 to have accurate scaling) to and then scaled down with TexturePacker to 1x and 2x sprite atlases.

But for cross-platform development I have to deal with all these resolutions plus some less popular (and sometimes unpredictable for Android).

I'm using tk2dCamera that scales content according to the resolution and Multiplatform Toolkit that positions and scales content by looking at the aspect ratio or platform. I'm not stretching sprites in games, but show larger pieces of the game world (when it's scrollable) or make some sort of letterbox (additional parts of background, more spacious GUI, etc.).

And I can't understand how to do the following things right.

Atlases for different DPIs
2d Toolkit has platform specific sprite collections and as far as I understand it is the same idea as I described above for cocos2d. But another method with mipmaps and changing quality settings is described in this thread.
I'd like to use the latter method for smaller game file size. But will resizing textures on the fly significally increase loading time of every scene? Is Unity capable of quality downscaling of 2d art? (not pixel art)

Scaling down on the fly
Since I can't include sprites for every possible resolution, most of the time they will be scaled down (e.g: 4x sprites made for 2048x1536 will be scaled to 1600x1200 or 1920x1080). If I'm getting it right, all I need is a right setting for each resolution in tk2dCamera.

Relative positioning
It's simple for GUI with Multiplatform Toolkit, but I can't understand how to move dynamic objects in different DPIs and ratios.
Is tk2dCamera always counting 1 pixel for 1 Unity point and do I need to calculate positions and movement relating to DPI (multiply them by 1x-2x-4x)? Is scaled down content (by tk2dCamera, like from 2048x1536 to 1600x1200) not affecting pixel-to-points, but only physical size on the screen?

upd: the answer from this thread is "no, 1x, 2x, 4x sprites will all be physically exactly the same size, so distances will still be the same".
As far as I understand, I should work with points in 1x size and then despite 2x or 4x or other custom multiplier, my sprites always will use 1x point system. So I need to set up GUI and game world visibility for the lowest resolutions for all aspect ratios and then tk2dCamera will help me to scale it up using bigger sprites.

Pages: 1 [2] 3