2D Toolkit Forum
2D Toolkit => Support => Topic started by: Siddharth3322 on January 24, 2014, 12:58:40 pm
-
I am using tk2d for my 2d game development and quite happy with this tool.
But I have a question regarding multiple platform support although I want to mention that it was a natural behavior but I want to suggestion in that.
For level desing I use 480x320 resolution as 1x and for second resolution I use 1024x768 as 2x. I create a level using my native resolution but my script detect that I have to load second graphics.
At that time second graphics loaded but using old position and size only.
Following image demonstrate my problem correctly. So I want some suggestion to correct this situation.
-
Position and size doesn't change so you don't have to reposition anything. Use the tk2dCamera to rescale the camera when the resolution changes. Eg. Set the override to FitVisible to start.
-
First thank to you for replying me. It is big thing to me to get reply to me.
Sorry for my stupid question but how to scale camera? Are you talking to change zoom factor?
If yes then as per my assumption I get single dimension to set focus on game area and as a result I get black bars. So basically starting multiple graphics usage to tackle only this issue.
-
No, check the overrides tab - thats what they're there for. Change it to Fit Visible for starters.
-
I get new graphics loaded but with above image only. Here I attach my camera override so that you guide me properly.
-
That looks correct.
One potential problem is your 1x and 2x resolutions. As the names suggest they should be 1x and 2x the size, so 0.5x 1024 = 512, not 480. While it will work, it will be more complicated as it will change the size of the sprite.
Assuming you don't change the texture resolution, does it work properly then? What does your game window look like when set to then native resolution? For that matter what is your native resolution in tk2dCamera?
-
First of all my three selected resolution are :
- 960x640
- 1920x1080
- 2048x1536
Is it correct? Here I chose most widely used aspect ratios of three platforms for which I am targeting.
-
What is your native resolution in the tk2dCamera, and when your game window is set to that resolution does it look correct?
-
My tk2dCamera native resolution is 960x640 and in that resolution every thing looks perfect.
Following image demonstrate that thing.
-
It looks like you're on an old version of tk2d, and when you updated Unity that version became out of date. I don't think it'll pick up the correct game window resolution either.
-
My current version of 2D Toolkit is 2.2.3. Also I checked with version 2.3.3 but I reply with no change in output.
Is that thing creating problem for me?
-
Please update (the error message you're seeing in the console is an error, not just a warning). After that, switch your game window to 1920x1080 and post what you see. It should fit the screen.
-
When I use tk2d version 2.3.3 there is no error message on console.
I run my game and as a result I got following output in preview and graphics of 1920x1080.
Also I want to mention some coding that I used.
I create init scene which has empty game object. In empty game object I write following code also that is not final but for testing purpose it is ok.
Then I switch to my actual game scene.
-
Remove that code. What does it look like without it.
As I mentioned before your 2x texture must be twice the size of the 1x texture. Not bigger, or smaller.
-
If only use twice big texture then how to support multiple aspect ratios?
-
Thats up to you. You can have the image clip in the lower resolution, load a custom background using Resources.Load for different aspect ratios, etc. Depends on what you want with your game.
-
Thanks for your suggestions. Now I think over that if I stuck then I will disturb you. Sorry for that.
-
When I switch my current platform to iOS then why my texture of size 1024x1024 become 1024x768 in size?
If I switch my target platform to any other then what changes occur?
-
It depends on what override you have set up in the camera.
http://2dtoolkit.com/docs/2.4/reference/tk2dcamera.html
-
Reading last few posts given by you. I think that I have to create textures of size 512x512, 1024x1024 and 2048x2048.
Then which platform texture need to be loaded decided based on device screen resolution and dpi. Am I right in this case?
-
@unikronsoftware, sorry about this repost. But for long time I can't able to solve my problem. If you point some example that it become useful to me and other member also.
-
Please register your copy of 2D Toolkit for further support.