Apress / Devel-2D-Games-Unity

Source Code for 'Developing 2D Games with Unity: Independent Game Programming with C#' by Jared Halpern
https://www.apress.com/us/book/9781484237717
Other
215 stars 53 forks source link

Ch5 Coin Sprite #22

Closed houthkenny closed 4 years ago

houthkenny commented 4 years ago

Hi, I'm having trouble getting the coin sprite to be visible in the scene view. I've put the sorting layer to objects just like the book instructed, but for some reason the sprite still won't render, any help/ideas?

houthkenny commented 4 years ago

nvm I figured it out, After changing the camera view from 2d to 3d It showed the coin sprite wasn't in viewing parameters for the camera, playing around with positions on the coin object help fixed the issue.

JaredHalpern commented 4 years ago

Thanks for updating and closing the ticket @houthkenny

scouttyg commented 4 years ago

Note: I ran into the same problem here, and like @houthkenny mentioned, it was due to the CoinObject being set in a negative Z direction, which seems to have happened just by dragging the CoinObject into the Scene.

To fix this, in the Inspector for the CoinObject, look under the Transform section, in the Position attribute area. There should be coordinates for X, Y, and Z, which correspond to where the coin was placed within the Scene. Make sure that the Z attribute is not set to a negative value, as this will have it appear "below" the world. Setting this value to 0 should make it show up correctly.

JaredHalpern commented 4 years ago

Thanks so much for the feedback @scouttyg. I've noticed that Unity sometimes does this as well. Not sure why, and it's not consistent behavior. I might file a bug report with them.