Hello Guest

Author Topic: Camera Overrides, broken link  (Read 7351 times)

drkucho

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 72
  • Retro Arcade Freak
    • View Profile
    • Dr. Kucho!
Camera Overrides, broken link
« on: June 04, 2014, 11:45:38 pm »
hello, im trying to understand more about camera overrides but this link is wrong

http://www.unikronsoftware.com/reference/tk2dCamera

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Camera Overrides, broken link
« Reply #1 on: June 05, 2014, 12:10:09 am »
Where did u get that link from?

The link to docs should be here:
http://2dtoolkit.com/docs/latest/
and tk2dcamera - http://2dtoolkit.com/docs/latest/html/classtk2d_camera.html

drkucho

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 72
  • Retro Arcade Freak
    • View Profile
    • Dr. Kucho!
Re: Camera Overrides, broken link
« Reply #2 on: June 05, 2014, 12:49:39 am »
i googled 2d tool kit camera and end up on one page that was working but then that link inside it was not , in fact if i go to
http://2dtoolkit.com/docs/latest/tutorial/tk2dcamera.html and then scroll down to the Overrrides section , the link on there to the reference page is the same link i was clicking and still don't work

so that link to the reference page is the class reference page , ok , but i was expecting to get more tutorial kind of info, i really don't understand all the resolutions here and there

i am messing with these

tk2d camera native resolution
tk2d camera preview resolution
Unity/ProjectSettings/Player/DefaultScreenWidth/Height

i had no trouble at start cause i set all those to the same values, 1280x960

but now in my new monitor my game is starting to do crazy stuff with the resolutions so i am experimenting and im completely lost, i change the default width/height on unity player settings and does ..... nothing?

and the creziest thing, i have tk2d camera to 800x600 , unity player settings to 1344x1008 and the game starts at 1280x960 ... what da hell is going on here?

drkucho

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 72
  • Retro Arcade Freak
    • View Profile
    • Dr. Kucho!
Re: Camera Overrides, broken link
« Reply #3 on: June 05, 2014, 09:22:11 am »
some more info , im using 

edit/project settings/Player/Default is Full Screen --> Off
edit/project settings/Player/Resolution dialog --> Disabled

and when i build the game and run it insist on going full screen alone, even having that setting OFF , and also it goes to a resolution that is not on the player settings nor on the tk2d camera

i revised my code there is no Screen.SetResolution statement anywhere , i experimented with this a few builds back but now is deleted , so i really don't know whats going on

probably you won't be able to know whats happening from there, but any idea of what to try? also some clarifying about how all those resolution settings on tk2d camera and player settings should be used would be welcomed

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Camera Overrides, broken link
« Reply #4 on: June 05, 2014, 09:59:20 am »
Quote
some more info , im using 

edit/project settings/Player/Default is Full Screen --> Off
edit/project settings/Player/Resolution dialog --> Disabled

and when i build the game and run it insist on going full screen alone, even having that setting OFF , and also it goes to a resolution that is not on the player settings nor on the tk2d camera

tk2dCamera doesn't set any resolutions. You need to figure out why unity is doing that.


1. Pick a native resolution. This is the resolution you're designing your game for. Enter that in the tk2dCamera
2. Set up game window resolution to the same
3. That should be it, you should see pixel perfect output


The tk2dCamera helps when you're trying to run this at a resolution different to what you designed it for. Eg. If your native resolution is 1024x768, and you run it at 960x640... what do you do? The tk2dCamera overrides let you choose. The tk2dCamera uses the game window resolution, set the game window to the exact resolution you want to preview (960x640  in this case). You can then see the effect of the overrides.

drkucho

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 72
  • Retro Arcade Freak
    • View Profile
    • Dr. Kucho!
Re: Camera Overrides, broken link
« Reply #5 on: June 05, 2014, 10:21:44 am »
ok , if tk2d camera does not set any resolution, at least i know that this mess is coming from unity itself, ill do more tests

drkucho

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 72
  • Retro Arcade Freak
    • View Profile
    • Dr. Kucho!
Re: Camera Overrides, broken link
« Reply #6 on: June 05, 2014, 12:14:44 pm »
look what i have found : this is a unity preference file , that it was on the my mac library/preferences folder , its called unity.Dr. Kucho!.Ghosts'n DJs.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
   <key>Screenmanager Is Fullscreen mode</key>
   <integer>0</integer>
   <key>Screenmanager Resolution Height</key>
   <integer>960</integer>
   <key>Screenmanager Resolution Width</key>
   <integer>1280</integer>
   <key>UnityGraphicsQuality</key>
   <integer>0</integer>
</dict>
</plist>

that could explain no matter what i do the game always go 1280 x 960 , but funny thing is i delete this file and it is self created again as soon as i do a new build, no idea where is unity getting those screen settings, now i have 1024 x 768 but it doesn't matter, it keeps on going 1280 x 960 , im starting to laugh on this better than trowing myself trough the window LOL

im gonna ask on unity forums , but if you have any ideas i would welcome them

drkucho

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 72
  • Retro Arcade Freak
    • View Profile
    • Dr. Kucho!
Re: Camera Overrides, broken link
« Reply #7 on: June 05, 2014, 12:41:10 pm »
its fixed, the problem comes from the fact unity stores the last resolution used in the a file containing some user specific preferences such as screen resolution and others

you set the screen resolution un unity/edit/playerSettings the first time you build and its cool, you do it once the game has been run at least once and it does not make any change cause the game will pick the resolution from this file, this is not so smart unity guys :-)

this is what i did

delete that file

put this code in one of my scripts

function OnApplicationQuit(){
   PlayerPrefs.DeleteKey("Screenmanager Is Fullscreen mode");
   PlayerPrefs.DeleteKey("Screenmanager Resolution Height");
   PlayerPrefs.DeleteKey("Screenmanager Resolution Width");
}

run again

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Camera Overrides, broken link
« Reply #8 on: June 05, 2014, 12:57:41 pm »
In almost all the projects I've worked on we simply dont use the unity resolution thing. In most cases you want to be able to change resolution while in game anyway... so we just code it all ourselves, including the key remapping, and turn off that window at startup.

drkucho

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 72
  • Retro Arcade Freak
    • View Profile
    • Dr. Kucho!
Re: Camera Overrides, broken link
« Reply #9 on: June 05, 2014, 07:48:06 pm »
thanks for the advice, i try to keep my code to the minimum to avoid to complicate myself with too much stuff, its my first project so ...

but ill keep your words in mind if the resolution thing gets messed up again