I have 64x64 texture of tree :
but output gives me this (black messed object is my tree)
If i drag sprite into editor, its rendered as meant to be(with new gameobject created). But im accesing it through script :
public Sprite treesIcon;
SpriteRenderer sr;
TileTypeHandler typeHandler;
void Start () {
sr = GetComponent<SpriteRenderer>();
}
void Update () {
switch(typeHandler.tileType) /// nevermind enum, its edited
{
case TileType.Woods:
{
sr.sprite = treesIcon;
break;
}
}
}
point is to dynamically change textures.
Can anyone explain me this behaviour? Is there somethin I am missing about sprites and textures? How can i fix it?


GameObjectyou have the sprite set. I think this is a problem with the shader, or the alpha channel. - AntiHeadshot