Hello, everyone. I have a stupid question: I want to set a boolean to true if an object’s sprite renderer is using a certain sprite, however I am unsure how to do so. When I use this code I get an error which says “The name sprite does not exist in the current context”:
bool myBool;
SpriteRenderer sr;
void Start () {
sr = GetComponent<SpriteRenderer>();
}
void Update () {
if (sr.sprite == mySprite)
{
myBool = true;
}
}
If anyone knows how to do this correctly, please tell me. Thanks.