Best practice to find object in List of custom classes? Do if in list, if not do something else

BUT!!! Be very careful with enumerated types since Unity’s YAML serializer does not save the mnemonic of the enum but rather just an integer. If you change your enum in code, you could potentially silently bork all your prefabs, assets and scenes that contain these non-identifier serialized numbers. I try to stay away entirely from enums for anything that I am going to let Unity serialize. Otherwise they’re great.

using UnityEngine;

[CreateAssetMenu]
public class Attack : ScriptableObject
{
    //NEVER REMOVE OR INSERT ANY ITEMS! Only add to END OF LIST!
    public enum DamageType {
        NORMAL,
        MAGIC,
        ELECTRICAL,
    }

    public DamageType damageType;
}

The object I made:

6323361--701142--Screen Shot 2020-09-17 at 4.48.19 PM.png
And the YAML:

%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_GameObject: {fileID: 0}
  m_Enabled: 1
  m_EditorHideFlags: 0
  m_Script: {fileID: 11500000, guid: 803d7771239ff4fd8be580a5e0888338, type: 3}
  m_Name: New Attack
  m_EditorClassIdentifier:
  damageType: 2

See the last line where damageType is serialized?

Veeeeeeeery dangerous, especially in a team work environment!