- Home /
Strange behavour when drawing on texture
I have created texture 256x192 in script which is used for UI Image. When I am drawing line which is above texture height then is not displayed, but when I draw line which is longer than texture width then is displayed without any problem. My desired effect is to have texture which is scaled to this component.
void Start () {
AddToDiagramLineHistory(RandPontsPosition(10));
texture = new Texture2D(textureWidth, textureHeight, TextureFormat.ARGB32, true);
InitTexture(texture);
DrawDiagramLine(texture);
texture.Apply();
Sprite newSprite = Sprite.Create(texture, new Rect(0, 0, textureWidth, textureHeight), new Vector2(0.5f, 0.5f), 100f);
image.sprite = newSprite;
}![alt text][1]
[1]: /storage/temp/91111-123.png
123.png
(356.9 kB)
Comment
Your answer
Follow this Question
Related Questions
Image distorts when created in C# 3 Answers
Texturing custom 2d sprite 0 Answers
Access sprite secondary texture in shader for UI canvas image 1 Answer
sprite border 0 Answers