Having Variables store a script in the inspector

i’ve been trying to make a script, this is it

class WeaponList 
{
	var point_weapon	: Weapon;
	var flag_obtained	: boolean;
	var main_ammo		: Ammo;
	var list_ammo		: Ammo[];
}

var list_weapons		: WeaponList[];

what i want this script to do in the inspector is allow the user to attach a script at Weapon and Ammo, however at the moment when i try and drag a script over to one of these the script doesn’t attach, and i missing some code in this?

EDIT: there actully are scripts called Weapon and Ammo created, i use them as templates

there are 3 types of scripts in unity as others said.

  1. MonoBehaviours are classes which you define in js without even using the class keyword and you can attach them using a gameObject/Prefab with that script attached. they are a component and can not be attached.
  2. normal classes (i.e derrived from System.Object) which if you want them to be shown in inspector to be able to change their values like Vector3’s inspector, in C# you need to set [System.Serializable] attribute for them but in js it’s implicit too just derrive from System.Object like the code example below.
  3. scriptableObjects are a great type which developers don’t use that much. if you derrive from it then you can save the class as an asset in your project and you can drag assets of this type to a variable of the same type just like Texture2D and other asset types. to create an asset you need to use the UnityEditor.AssetDatabase class.

code example for the second type of scripts

class test extends System.Object
{
//class definition
}

if you want to know more about scriptableObject data scripts you can take a look at Character customization example project

What kind of objects are Weapon and Ammo?

Are they MonoBehaviors, simple classes, ScriptableObjects, or something else?

It makes a difference.

If they’re simple classes you can declare them as public (the default) and they will appear in the inspector.

If they’re MonoBehaviours, you can’t directly drag and drop them onto another script.

In that case you would have to drag a GameObject that has a Weapon or Ammo script attached to it onto the Weapon and Ammo slots.