Can I change a gameObjects Layer?

A LayerMask is a bitmask, it’s not intended to represent a single layer.
If you want to set a layer, use an int.

Sadly if you want a dropdown for a layer selection, you will have to make your own property drawer.
Here’s one of my own:

public int GroundLayer;

// In LayerAttribute.cs
public sealed class LayerAttribute : PropertyAttribute { }

// In LayerDrawer.cs, in an Editor folder
public sealed class LayerDrawer : PropertyDrawer
	public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
		if (property.propertyType == SerializedPropertyType.Integer)
			int layer = EditorGUI.LayerField(position, label, property.intValue);
			if (EditorGUI.EndChangeCheck())
				property.intValue = layer;
			EditorGUI.LabelField(position, label.text, $"{nameof(LayerAttribute)} shouldn't be applied to {property.propertyType}, it's only valid on ints.");

#if UNITY_2021_1_OR_NEWER
	public override VisualElement CreatePropertyGUI(SerializedProperty property)
		LayerField layerField = new LayerField(property.displayName) { bindingPath = property.propertyPath };
		return layerField;
	private static readonly string AlignedFieldUssClassName =
#if UNITY_2022_2_OR_NEWER
		BaseField<int>.ussClassName + "__aligned";