C# Changing a PARENT object's sprite with OnMouseEnter (on it's child object)
So I'm trying to, when I move my mouse over a child of my parent object, change the parent objects sprite until OnMouseExit. I'm pretty new, so I can't figure out if (or how) I need to load the sprites within my script, or just use a reference to the folder location? Slightly confused.
This is all in 2D, if that matters. Thanks!
It doesn't matter how you load the sprite. Easiest way is to assign it in inspector.
What? Assign the sprite to what? How? It needs to trigger on mouse over on another object, not just be the active sprite in the scene.
You need a controller script anyway to tell it what to do. The controller script contains the On$$anonymous$$ouseOver check, and the reference to the sprites that you want to use. When the event is called you change the sprite. It can be done wth Resources.Load or through an inspector-assigned reference to the sprite. The point is to have all sprites loaded or referenced somehow and have a code that changes the sprite.
Your answer
Follow this Question
Related Questions
Why does disabling an object eliminate its transform performance cost? 1 Answer
Why my parent follows its child game object? 0 Answers
How do I make character pick up object to front of him? 1 Answer
How could I make the children of an object face the direction it is moving on the y-axis? 0 Answers
The most resource efficient way to dynamically find specific child in parent? 1 Answer