Hello, I am fairly new to Unity and all I want is to load a sprite through a script and change it there. This is the code:
SpriteRenderer sr;
Sprite test;
void Start()
{
sr = GetComponent<SpriteRenderer>();
test = Resources.Load<Sprite>("test.png");
sr.sprite = test;
}
However, when I print the name of the sprite it only shows “null”. So I thought that it just had to do something with the way I load the sprite.
Any help is appreciated.
Also, here is a picture of my file: