Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by OxDEADBAAD · Jul 08, 2014 at 12:51 AM · spritesquadover

[Solved] Display quad over sprites?

Hi!

I'm rather new to Unity and I'm trying to configure a scene for my game.

To get you in context: it's a platforming game, so I want my player to move, backgrounds to scroll with parallax and, in this case, everything to be behind some fog. Since it's a 2D game, I use an orthographic camera.

First I made my player and my ground from sprites.

After that, I recreated the parallax effect by making materials with my background layers and then making quads that use those materials. Then did a very little script that changes the offset of the texture according to the camera's position and the z position of the quads.

Then I tried to do something similar for my fog, attached some more quads to the main camera and made materials with my layers of fog and placed them into the scene, leaving my player and my ground between the foreground and the background quads.

Here's my scene:

alt text

My problem is that ALL of my quads seem to render behind any sprite that is not in the "Default" sorting layer no matter what Z I give to anything, so I get this:

alt text

I've been googling a lot but I just can't figure this out. I either need to decide where my quads are drawn somehow or look for another way to do the effect.

Any answer for any of the options is welcome :P

Thanks in advance!

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image meat5000 ♦ · Jul 08, 2014 at 01:06 AM 0
Share

http://docs.unity3d.com/$$anonymous$$anual/class-SpriteRenderer.html

avatar image OxDEADBAAD · Jul 08, 2014 at 01:44 AM 0
Share

Thank you! That was actually helpful.

For the record: when you draw all of your sprites in the "Default" sorting layer, you can use you z coordinate to deter$$anonymous$$e the rendering priority.

avatar image meat5000 ♦ · Jul 08, 2014 at 01:50 AM 0
Share

I believe you should be able to order anything within its layer with Z. I'm guessing layers closer to 0 get more priority.

Glad the link helped!

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Eric5h5 · Jul 08, 2014 at 01:48 AM

Use renderer.sortingLayerID and renderer.sortingOrder. Feel free to use a perspective camera to do parallax, by the way, instead of having to control it with scripting. There's no requirement to use an orthographic camera for 2D.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image OxDEADBAAD · Jul 08, 2014 at 02:09 AM 1
Share

This works too. If you have everything set up like I showed in my first screenshot and your sorting layers are kinda like these:

alt text

doing:

 renderer.sortingLayerName = "Foreground";

to your quads will render them in that sorting layer.

Thank you too, Eric!

Edit: and about the perspective camera for the parallax, I will give it a try too :)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

how does the animation window work in unity 5 2 Answers

Planes With texture on it seem to move independently in Orthographic mode 0 Answers

How to resize a quad to fit the dimensions of a sprite/.png ? 2 Answers

Reduce RAM memory by using Atlases 0 Answers

Sprite moving as a flag 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges