Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

How can I set the wrapmode of a texture in a MaterialPropertyBlock?

Discussion in 'General Graphics' started by Phedg1, Jun 14, 2019.

  1. Phedg1

    Phedg1

    Joined:
    Mar 3, 2015
    Posts:
    113
    I can set a texture on a material and make that texture have the .wrapMode = TextureWrapMode.Repeat and the texture will tile perfectly. However, when the texture is set through a MaterialPropertyBlock and that property block is applied to a Renderer instead, I can't seem to get it to repeat.

    Code (CSharp):
    1. myTexture.wrapMode = TextureWrapMode.Repeat;
    2. myPropertyBlock.SetTexture("_MainTex", myTexture);
    3. myRenderer.SetPropertyBlock(myPropertyBlock);
    How can I make a MaterialPropertyBlock tile/repeat its texture?
     
unityunity