how to make an add component button and funktion unity code example
Example 1: unity add component
//Use the AddComponent<T>() Method to add a component to your gameobject
GameObject gameObject;
gameObject.AddComponent<BoxCollider>(); //Component has to be an actual Unity component
Example 2: On add component unity
void Reset()
{
//Your code here
}