34 lines
706 B
C#
34 lines
706 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Utils
|
|
{
|
|
namespace Utils
|
|
{
|
|
[Serializable]
|
|
public class GameEntry<T>
|
|
{
|
|
public string key;
|
|
public T value;
|
|
}
|
|
|
|
public static class GameObjectEntryListExtensions
|
|
{
|
|
public static T ByKey<T>(
|
|
this List<GameEntry<T>> entries,
|
|
string key
|
|
) where T : class
|
|
{
|
|
foreach (var entry in entries)
|
|
{
|
|
if (entry.key == key)
|
|
return entry.value;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
|
|
} |