public static int GetPresetIndex <T>(T preset) where T : PumkinPreset { int i = -1; if (typeof(T) == typeof(PumkinsCameraPreset)) { i = CameraPresets.IndexOf(preset as PumkinsCameraPreset); } else if (typeof(T) == typeof(PumkinsPosePreset)) { i = PosePresets.IndexOf(preset as PumkinsPosePreset); } else if (typeof(T) == typeof(PumkinsBlendshapePreset)) { i = BlendshapePresets.IndexOf(preset as PumkinsBlendshapePreset); } return(i); }