티스토리 뷰

반응형

https://github.com/Louis1351/Drawing-UI-Texture-package

 

GitHub - Louis1351/Drawing-UI-Texture-package: Tool to add drawable RawImage for Unity (using only GPU to improve performance).

Tool to add drawable RawImage for Unity (using only GPU to improve performance). - Louis1351/Drawing-UI-Texture-package

github.com

 

 

위 패키지를 이용하여 구현

 

사용법이 매우쉬워서 위 링크를 참고하면 되고,

 

스크립트만 간단히 공유하면

 

using LS.DrawTexture.Runtime;

private void MyFunction()
{
    DrawTextureUI myDrawTexture = GameObject.FindObjectOfType<DrawTextureUI>();
    
    //To get current texture
    Texture2D myTexture = myDrawTexture.GetTexture2D();
    
    //To reset texture
    myDrawTexture.Clear();
    
    //To change brush texture
    myDrawTexture.IdTexture = 0;
    
    //To change brush size
    myDrawTexture.Size = 0.5f;
    
    //To change brush Opacity
    myDrawTexture.Opacity = 0.01f;
    
    //To change brush mode
    myDrawTexture.Type = DrawTextureUI.BrushType.none;
    
    //To change brush color
    myDrawTexture.Color = new Color(1.0f,1.0f,1.0f,1.0f);
    
    //To allow brush application on alpha texture
    myDrawTexture.DrawOnTransparency = true;
}
반응형
댓글
반응형