Anyone having issues with detecting device screen size on the first load of the first scene?

So I'm detecting the device screen size to adjust the camera height and camera origin so I can have auto stretching with universal binaries.

For some reason on a 3rd gen ipod (480 x 320 resolution, same as iphone 3gs) the first time the first scene loads - it won't use the camera origin offset that I've set.

When go to the second scene that does use the offset. And when I go back to the 1st scene it now uses the offset.

But on that initial load of the menu - there is a gap at the top of the screen because the camera origin offset is not being used.

Just wondering if anyone else is having the same issue and what a workaround might be? Also, does this happen on an iphone 4 or 5?

Only thing I can think of is to have a 'blank' scene as the first scene which is mainly black with a studio logo or something. Then you won't notice that the cam offset is wrong. But it's a bit crap to have to insert additional loading time.

Best Answer

Answers

  • JSprojectJSproject Member Posts: 730
    Try "constrain attribute" instead of "change attribute" (2:06 in the video by Darren)
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    @js.ios.game Hi, thanks for the suggestion. I might try that but generally I try not to use constrain behaviors that are always active. The game is already quite 'full' so I'm nearly in the optimising stage.
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    @tenrdrmer. Cheers. I'll see if I can figure out the minimum time/events it needs to be constrained.

    As far as I can tell it only happens on the initial load of the first scene, or when coming back to the first scene having closed the game. All other situations seem to maintain the camera offset as specified by the rules I set up.
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    My biggest issues are when you use pause. I'm finding if I drop a constrain on your rule the fires the pause scene. While it screws up the origin of the base scene which you can see if you have any transparency in your pause scene. When you un pause it pops back to where it should be. Hope it helps you out.

    Cheers
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    Ah ok. In my case I never use the pause behaviour. Never liked the idea of loading an overlay scene. Especially if it's, literally, to only pause the game :)
  • UtopianGamesUtopianGames Member Posts: 5,692
    edited February 2013
    Have you got the actor with the device rules right at the bottom layer?

    Gs reads backwards so make sure its right at the lowest point in the layers.

    If your still having problems you could wrap it in a timer mb.

    Darren.
  • HoneyTribeStudiosHoneyTribeStudios Member Posts: 1,792
    @DeepBlueApps.com Yeah it's the first rule of the first object on the scene. So it seems to be a GS bug of some kind rather than any error in logic.

    I'll either try constraining for a certain time or just include a blank scene as the first scene.
  • ChirpinGamesChirpinGames Member, PRO Posts: 214
    @tenrdrmer did you have any luck fixing that pause bug?
  • POMPOM Member Posts: 2,599
    edited February 2013
    There is this "bug" i found..

    Make sure you preview on 100% and not on 50%
    If you preview the game in ipad mode for example, then the value of the attribute
    "screen.size.width" will be 1024 right? , and when dealing with universal builds you mostly rely on this value cause you move stuff around and manipulating the camera and on and on.. based on this value.

    BUT, if you preview this same ipad project on 50% preview mode, it will register the value of the "screen.size.width" to 512 instead of 1024, and this breaks your rules and can drive one crazy

    photo ipad-screen-size_zps6df37346.png

    Roy.
  • ChirpinGamesChirpinGames Member, PRO Posts: 214
    Hey Roy, The bug i'm talking about happens when you change the camera offset and then activate a pause screen over the top, if that pause screen has transparency you can see the original scene below it but for some reason it resets the camera offset in that scene. Very weird. Ive tried a few things like constraining the rules and also resetting them just before the pause scene activates but nothings working so far..

    I've set it up to show you from Darrens original universal project file if you're keen to have a look?
    https://dl.dropbox.com/u/5079681/Bug_Example.zip

    You just change the scene to one of the iphone layouts and select crop. Then hit pause and see what happens. I'd love some help if anyones got some spare time?
    Thanks!
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    edited February 2013
    @chirpingames if you place a constrain for the cam origin in the rule that fires the pause. It doesn't fix it while the pause is on but it does get it to reset the origin back when you unpause.
  • ChirpinGamesChirpinGames Member, PRO Posts: 214
    Thanks @tenrdrmer I did figure that one out, it just looks so bad when you see the scene in the background move. I think it must be the way gamesalad is loading the pause scene over the top and so I dont think theres anything we can do about it!
  • RoksaltRoksalt Member Posts: 87
    edited May 2013
    BTW @tenrdrmer [and those of you playing at home] you can simply use another rule

    WHEN device AUTO-ROTATION = FINISHED
    Change attribute Camera Origin to -46 / -128 [iPhone 4 and 5]

    In conjunction with the initial Change attribute rules [as per Darren's video] in case someone rotates the device whilst playing. This way you don't need to use a CONSTRAIN behaviour and waste precious FPS

    :-)
Sign In or Register to comment.