On trigger enter fade in gameobject ?

Hello, I was wondering if and how you can fade in a gameobject when a player walks into a trigger, I have a scene set up where I wanted a area that a play walks in a game object of a wall will fade in (kinder like a force field) and I was wondering how do you go about doing that in Unity (java-script format if you could)?

Thank you for your time, have a nice day.

Yes it is Possible to do that.

  • Make sure the shader you are using contain Alpha content
  • Change the Alpha value from the color
  • You can lerp the Alpha value to 0 - 1 or 1 - 0.

Use this for reference

Hope this will help you


I know this is ver old and things have moved way on but just wanted to point out that after struggling with this myself I created a script for anyone facing this issue: GitHub - kakubei/swapicons: C# Unity script to fade out a sprite, swap it with another and fade in