Files
unity-application/Assets/MediaPipeUnity/Scripts/ModelList.cs
2023-03-26 22:44:43 +02:00

40 lines
1.2 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Unity.Barracuda;
/// <summary>
/// This scriptable will hold tupples of Courseindices and models
/// </summary>
[CreateAssetMenu(menuName = "Create new Scriptable/ModelList")]
public class ModelList : ScriptableObject
{
/// <summary>
/// Index of the currently active model
/// </summary>
public int currentModelIndex = 0;
/// <summary>
/// A list of all the models
/// </summary>
public List<ModelTuple> models = new List<ModelTuple>();
/// <summary>
/// Get a model by modelindex
/// </summary>
/// <param name="modelIndex">ModelIndex of the model</param>
/// <returns>Model associated with this index, null if no model was found</returns>
public NNModel GetModelByIndex(ModelIndex modelIndex)
{
return models.Find((m) => m.index == modelIndex).model;
}
/// <summary>
/// Function to find a model-index in the list based on its index
/// </summary>
/// <param name="title"></param>
public void SetCurrentModel(ModelIndex index)
{
currentModelIndex = models.FindIndex((m) => m.index == index);
}
}