Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Adding a Mask as secondary texture at runtime

Discussion in '2D' started by AndreasET, May 29, 2023.

  1. AndreasET

    AndreasET

    Joined:
    Dec 20, 2016
    Posts:
    6
    Hello,

    We are currently creating 2D sprites at runtime and loading their textures from our server.
    We also add normal maps as secondary textures by using the following code:

    renderer.material.EnableKeyword ("_NORMALMAP");
    renderer.material.SetTexture("_NormalMap", texture2D);

    Is it possible to add a mask as a secondary texture as well using the same approach?

    Thanks!

    /Andreas
     
    Last edited: May 31, 2023
  2. AndreasET

    AndreasET

    Joined:
    Dec 20, 2016
    Posts:
    6
    Solved. "_MASKTEX" plus "_MaskTex" worked fine.