iro*_*and 4 c# unity-game-engine
我想Times在Unity中使用函数,通过这个站点我使用这个脚本.
public static class IntExtensions
{
public static void Times(this int i, Action<int> func)
{
for(int j = 0; j < i; j++)
{
func(j);
}
}
}
Run Code Online (Sandbox Code Playgroud)
但它会导致错误Assets/Resources/Scripts/Board.cs(27,40): error CS0246: The type or namespace name动作1' could not be found. Are you missing a using directive or an assembly reference?.
Action在Unity C#中看起来没有.
有没有办法在Unity中使用该功能?如果我想在整个Unity项目中使用,我应该把文件放在哪里?