Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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
1
Question by MrAmazing · Nov 05, 2015 at 09:11 PM · gameobject2d-platformerlayers

2D Platformer: Area under platform hiding player

Hello All,

I'm new to using Unity, but have experience in game design otherwise, and I'm hoping you can help me with something that should be pretty straightforward, but I'm just not sure how to do it.

I have a prototype of an infinite runner, with the scripts needed to spawn platforms as the game goes, but they are just floating platforms. I want to add some body to the platform so I'm trying to add another cube gameobject below them to look like the platforms are elevated. The problem is they cover up the player, and I'd like the player to be in front of them.

alt text

That bit of grey (where the arrow is pointing to) hides the player, and I'm looking for more of an old-school Mario thing where the player walks in front of that, but still interacts with the platform above it.

Thanks!

platformer-question.png (5.2 kB)
Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by DeathDev · Nov 05, 2015 at 11:23 PM

Hi! I've come across this problem several times in using Unity's 2D system.
There's a few things that could be causing this:
A) There is an object in 3D space in front of the sprite(For instance a plane.)
B) The camera is not set to orthographic(2D)
C) The character object's sprite-renderer Order in Layer value is set to 0.

Now, for the solutions!
A) Disable the object, and replace it with a 2D sprite that has a lower Order in Layer value versus the player.
B) Set the camera to orthographic :p
C) Set the character object's sprite-renderer Order in Layer value to something higher than 1.

Hopefully this helped. If it didn't, feel free to comment on this and I will attempt helping you further. :)

Comment
Add comment · 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
0

Answer by MrAmazing · Nov 06, 2015 at 01:45 PM

Thanks for the quick answer @DeathDev!

I think the issue I'm causing myself is that I'm making 3D game objects that are sticking further out than the player. I fixed this by changing their z-axis to be behind the player and that seems to have fixed the problem.

Those, is there a way to create a 2D object(sprite) and just work in layers from there? That seems like a much simpler way to do it!

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 DeathDev · Nov 07, 2015 at 01:35 AM 0
Share

Yes! Just simply use the Order in Layer feature I mentioned. :) Just in case you don't know how to create a sprite, it's in GameObject->2D Object->Sprite

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 to cover buttons with game objects? 1 Answer

GameObject with a lot of Layer 0 Answers

Is it possible to have multiple layers on one object? 1 Answer

how do i create a game object array with gameobjects of multiple tags 1 Answer

Collider Is Touching Layers is not working... 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