Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Ideas on creating Parallaxing system that is based on Z value and/or Layer

Discussion in 'Scripting' started by Sophophilia_Studios, Jul 29, 2015.

  1. Sophophilia_Studios

    Sophophilia_Studios

    Joined:
    Jul 28, 2015
    Posts:
    21
    Hey everyone,

    So I am a newbie to Unity, Just switched after working with GameMaker for over 2 years. I had a really nice Parallaxing system built in GM that would work based on the objects Depth (Z in Unity) and It would work on both the X and Y axis. I need the Y cause my game has a lot of vertical movement. I downloaded
    Free Parallax for Unity (2D) (https://www.assetstore.unity3d.com/en/#!/content/29422) And I looked at the script and it had around 500 lines of code. That seems like complete overkill. And it didn't even support the Z or even sorting layer parallaxing.
    I also looked at the 2d platformer example with the spaceship and the potato dude. That was way simplier but I have the drag the background assets into the script. That seems very tedious and slow when you are working on a big game.

    I am gonna be trying to convert my GM code into Unity. But if anyone has any tips or a system already created that you want to share with me that would be much appreciated!

    Thanks
     
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    I think what's generally done is each Layer is assigned to its own camera and that camera is given a value to "lag behind" the main camera to easily create the effect.
     
  3. Sophophilia_Studios

    Sophophilia_Studios

    Joined:
    Jul 28, 2015
    Posts:
    21
    Hmmmm interesting. I have been working on a system that pulls the z value of objects with certain tags.
    you can see my work here
    http://answers.unity3d.com/questions/1018406/invalid-token-float-cs1519-cant-figure-out-how-to.html
    As you can see I am stuck, so I might try this layer business!
    Do you have any more info than that. Like and example file or something?