Search Unity

From Flash to Unity, I have questions.

Discussion in '2D' started by Barzona, Oct 11, 2017.

  1. Barzona

    Barzona

    Joined:
    Apr 8, 2014
    Posts:
    14
    I've been working on a game for the past few years and I've been making it entirely in Adobe Flash/Animate. Here's how it plays:



    I'm switching to Unity because Flash is being pushed out, and I'd like to take advantage of a lot of Unity's features like lighting effects and 3D features even though I'm making a 2D game. It would also be nice to know a program that could get me a job some day. I've literally only ever used Adobe Flash and written in AS3. I know very little else.

    My goal is to get my current game working in practically the same way in Unity as it does in Flash, but I have some questions:

    For one thing, I don't understand how screen resolution works. In Flash, your project area is defined by a dimension of pixels (900x500) or something. When I make assets, I obviously make them with the size of the play area in mind. When I import these same assets into Unity, they come in very small. I can stretch them larger, but since I'm making a pixel-art based game, I shouldn't really have my assets at even a slightly different resolution than the others. What am I missing in all this? Can I set up my screen in Unity the same way I would in Flash, or is it open-ended for a reason? Can I, at least, get my assets to come in at the proper scale?

    And about Unity's Physics Engine, I'd like to keep using it, but I'd also like it to function in a more constrained fashion like my current game. I made a fake physics engine for the Flash version and I like it's tighter functionality. Unity is too dynamic for my game right now. When one platform comes down on the edge of another, they will spin on their pivot point, but what if I wanted them to only spin past a certain point, then ease back into their original rotation? Control of their physics engine is not easily spelled out.

    Any help is appreciated.
     
  2. krisu

    krisu

    Joined:
    Jul 10, 2013
    Posts:
    40
    in unity 2D all resolutions (what you look how big is) sprites sizes etc depends of ortographicSize.

    you can just change ortographicSize in camera to make them larger/smaller/normal size all in one line of code.

    ortographicSize = x / ((( x / y ) * 2 ) * s )
    Where:
    x = Screen Width (px)
    y = Screen Height (px)
    s = Desired Height of Photoshop Square (px)

    for you that would be:
    camera.ortographicSize = 900.0 / (((900.0 / 500.0) * 2) * s)
    s = depends of 'Pixel Per Units' in SpriteEditor.
     
  3. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    You probably want to adjust the Pixels Per Unit setting in the sprite import settings.


    Absolutely. Don't scale your sprites (using the Transform component) unless you're doing something unusual. The size of a sprite on screen is determined by its Pixels Per Unit, as compared to the camera orthographic size (as @krisu says above).

    Really? Are you sure? Flash doesn't have a physics engine and as you know, many games don't need one. As soon as you start using physics, you are ceding control of your sprites to that engine. You will find yourself fighting it, as things don't move the way you want them to.

    If you're making an Angry Birds clone, then sure, let the physics engine knock blocks around for you. But if you don't need something like that, I strongly recommend not using it.

    Using the physics engine means giving up control. (Mostly. And some people might disagree.)

    Best,
    - Joe
     
  4. Barzona

    Barzona

    Joined:
    Apr 8, 2014
    Posts:
    14
    Okay, I set the pixels per unit to 50 instead of 100 and they are looking pretty much normal. I need to set that universally for all imports at some point.

    Fair enough. It's a relief to know that you feel the same and, yes, it was a fight trying to get it to do what I wanted, so I moved in my own fake physics engine and set those rigid bodies to kinematic for the time being. I have noticed, though, that my physics engine affects objects pretty strongly. What, in flash, was a mild jolt to upward force sends objects in unity flying. Have to work that one out..

    Heck, I don't know how anybody gets anything done in the game world anymore. I thought I did, but every framework I've looked at is so different and I can see the impact each one has on games made with it. I dare say that Flash has been the most adaptable and dynamic tool I've ever seen for making games (and some people might disagree). It made everything so easy for me. I will never stop missing the ability to create library symbols with linkage names and be able to make entire classes around them. I really could have made a big game all on my own with what I could do. Unity has been a close second so far, but it's still early and I'm still trying.
     
  5. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Hang in there, I think you'll come to love what you can do in Unity, and how quickly you can do it. But this will include learning which parts to ignore. ;)

    With your background and interests, you will probably find my article on 2D animation methods in Unity useful. It includes a bit of custom physics for a platformer-style character.