UniVRM/Assets/VRM10/vrmlib/Runtime/IndexExtensions.cs
ousttrue d53942a7bd merge vrm10
* MeshUtility を UniGLTF 下に移動
* Assets/VRM10 を追加
* JsonSchemaからのコード生成 UniGLTF/Editor/Generator を追加
2021-01-07 13:37:24 +09:00

25 lines
567 B
C#

namespace VrmLib
{
public static class IndexExtensions
{
public static bool TryGetValidIndex(this int? index, int count, out int outValue)
{
outValue = -1;
if (!index.HasValue)
{
return false;
}
var value = index.Value;
if (value < 0)
{
return false;
}
if (value >= count)
{
return false;
}
outValue = value;
return true;
}
}
}