Fade in and out obejcts in the way!

Hello guys, i would like some help if possible trying to accomplish a simple fade in and out of environment structures that are between camera and player, like for example if i have a passage made buy walls when player enter it they came transparent so player can see the floor to click to move the player, since is a click to move game.

Can anyone help me if possible.
Appreciate
Best regards

definitely start with google:

unity fade objects between camera and player

If i dont already do it i will not post this… a lot of topics appear, specially old and others with no longer information, missing information… but thank you anyway

As far as I can see you didn’t post any code so you haven’t even tried.

Get it working in the simplest sense:

  • Set up a plane for your ground
  • set up a cube that is the wall
  • set up a capsule that is the player that can go behind the wall.

Now… follow ANY of the suggestions in the tutorial to detect that you are behind the wall and make the wall transparent, or just swap out the wall material for a transparent-ish one.

Or try:

  • raycast to see if the player is behind the wall
  • when he is swap out the material
  • when he isn’t swap it back

At least that gets you STARTED…

1 Like

Make the logic work first (if player is in area X, print out “hooray”). Then disable the renderer (makes wall transparent). Finally, create an animation that moves the alpha of the material from 1.0 to 0.0.