Search Unity

Custom dynamic texture

Discussion in 'Scripting' started by Grey5, Aug 24, 2016.

  1. Grey5

    Grey5

    Joined:
    Sep 13, 2015
    Posts:
    8
    Hello, i managed how to set custom texture in code:
    Code (CSharp):
    1. noiseTex = new Texture2D(pixWidth, pixHeight);
    2. pix = new Color[noiseTex.width * noiseTex.height];      
    3. noiseTex.SetPixels(pix);
    4. noiseTex.Apply();
    5. MaterialPropertyBlock block = new MaterialPropertyBlock();
    6. block.AddTexture("_MainTex", noiseTex);
    7. GetComponent<SpriteRenderer>().SetPropertyBlock(block);
    And my question is, how to set 'point filter' to this texture?
    And how to make setting better :D
     
  2. lloydsummers

    lloydsummers

    Joined:
    May 17, 2013
    Posts:
    359
  3. Grey5

    Grey5

    Joined:
    Sep 13, 2015
    Posts:
    8
    Thanks