Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

How to determine which texture was hit within material

Discussion in 'Scripting' started by CashCache, Dec 4, 2020.

  1. CashCache

    CashCache

    Joined:
    May 16, 2016
    Posts:
    11
    Hello,

    I have a wall material that uses two textures - an inside and outside wall. When I raycast and hit the wall, I need to know what texture was hit so I can place the right decal in the hit position. As you can see from the image below, I want to place a brick decal if the brick texture is hit and a concrete decal if the concrete texture is hit.

    Is this possible using one material like this? Or am I thinking about this wrong?

    Capture.JPG
     
  2. CashCache

    CashCache

    Joined:
    May 16, 2016
    Posts:
    11
    It just occurred to me that since the material is made from a single texture, this might not be possible. Can anyone explain the proper way to accomplish what I need to do?