Search Unity

Getting a shadow with a sprite

Discussion in '2D' started by Armetron, Sep 9, 2018.

  1. Armetron

    Armetron

    Joined:
    Oct 7, 2016
    Posts:
    12
    So this is the first time I'm using 2D assets in a project so everything is relatively new to me. I am making a 2.5D platformer similar to The Simpsons arcade machine game, because of this I decided to use a 3d project to have it behave as 3d but only use 2d assets to keep the look. The camera is in orthographic and is tilted down about 25 degrees to give it "depth"

    What I want to do is cast a shadow using the directional light pointing straight down and the player sprite which is angled 25 degrees to face the camera so I have a reference point of how far "deep" I am to be able to land on objects like the box in the sceen.
     
  2. LiterallyJeff

    LiterallyJeff

    Joined:
    Jan 21, 2015
    Posts:
    2,689
    The default sprite shader doesn't take lighting into consideration.

    You'll need to make a new material (right click in Project, Create -> Material), and set the material to the Sprites -> Diffuse shader. Then use that material on your player sprite renderer.

    Just so you know, this is a pretty common problem people run into, so try searching a bit next time and I'm sure you'll find a solution. If you're still confused even after finding solutions, then by all means make a thread with your question.
     
unityunity