I'm creating a 2d Turret Defense game in C# and I have a question about the management of the updates of the turrets.
I want to create the menu over the turret sprite with several options for the upgrade.

My idea is to load the menu from the resources as sprite, assign it as child to the turret gameObject and then manage the comunication between the button to the turret to start the upgrade process.

**There is a way to assign a method/function to a resource freshly loaded?**

For example (in turret class):

```
Sprite myMenuButton = Resources.Load <Sprite> ("sprite_menu_to_load");
myMenuButton.OnMouseDown(){
// do something with the current turret's class
};

```

Or I have to save the gameObject sprite in resource folder with inside a script that will manage the OnMouseDown method searching the parent script of the turret and use the correct method?

For example (in menu sprite class):

```
void OnMouseDown(){
     GameObject parent = gameObject.transform.parent.gameObject;
     turretScript parentScript = (turretScript) go.GetComponent(typeof(turretScript));
     parentScript.doUpgrade();
}

```

Thanks for any help!