Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions Eventify/Core/Runtime/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static bool InRange(this int i, float min, float max)
public static string RemoveFirstLines(this string text, int linesCount)
{
var lines = Regex.Split(text, "\r\n|\r|\n").Skip(linesCount);

return string.Join(Environment.NewLine, lines.ToArray());
}

Expand All @@ -35,9 +36,12 @@ public static bool ContainsIgnoreCase(this string source, string toCheck, String

public static T GetRandom<T>(this IList<T> list)
{
if (list.Count == 0) throw new ArgumentException("list length can't be zero");
var randomIndex = UnityEngine.Random.Range(0, list.Count);
return list[randomIndex];
if (list.Count == 0)
{
throw new ArgumentException("list length can't be zero");
}

return list[UnityEngine.Random.Range(0, list.Count)];
}
}
}