How to use `Action` with Unity C#?
c#, unity-game-engine
Solution
The `Action<T>` delegate type is defined in the `System` namespace - make sure you have `using System;` as a directive at the top of your CS file.
Problem
I want to use `Times` function in a Unity, by following this site I use this script. ``` public static class IntExtensions { public static void Times(this int i, Action<int> func) { for(int j = 0; j < i; j++) { func(j); } } } ``` But it causes error: Assets/Resources/Scripts/Board.cs(27,40): error CS0246: The type or namespace name `Action 1` could not be found. Are you missing a using directive or an assembly reference? It looks like there is no `Action` in Unity C#. Is there way to use the function in Unity? And where should I put the file if I want to use throughout my Unity project?