Choose one beetwen Many Script


I have 10 script that do 10 different weapon but with the same main function.

I would like to make a GameObject that choose 1 between those scripts.
The problem is, I don’t know how to add all those script to my GameObject. I tried interface and heritage, but the inspector don’t want me to add them

I would like to make an array of MyWeapon[] and select randomly one to instantiate it on my player when he drop it.

But I can’t find a way to add all those script in the inspector in order to fill the MyWeapon[]

Do I have to create a gameobject for each script ?

I haven’t tested the script, but give it a try :

public void AddRandomScript( GameObject target )
    System.Type[] types = new System.Type[]
        typeof( Weapon1Script ),
        typeof( Weapon2Script ),
        typeof( Weapon3Script )
    } ;
    System.Type chosenType = types[ Random.Range( 0, types.Length )  ] ;
    target.AddComponent(chosenType) ;