I am trying to use Array.Fill
in my program but I am getting an error saying that there is no definition for Fill
. I left off the function name in the title of this post because the same problem seems to happen for multiple functions in Array
. I found multiple forum posts online where people had the same problem and for them the solution was to add using System;
or using System.Linq;
, but I already have both of these. I suspect the problem is that I need to somehow add the assembly System.Runtime.dll
which contains the definition for Array.Fill
, but I am using Unity with Visual Studio for Mac and I have not been able to find a way to manage assemblies in either program. I have also been unable to find a project or solution file anywhere (I believe that is where I would add an assembly). Here is the problem line:
Array.Fill<Vector4>(cross, Rot4.Cross(vs[0], vs[1], vs[2]));
Does anyone have any idea what I can try? I suppose I could fill my array manually, but I want to know why this isn't working.
Array.Fill
is not available in .NET Standard 2.0, but 2.1,
https://learn.microsoft.com/en-us/dotnet/api/system.array.fill?view=netcore-3.1
But Unity does not yet support .NET Standard 2.1, https://docs.unity3d.com/2020.1/Documentation/Manual/dotnetProfileSupport.html but 2.0.
So in your case, you have to use workarounds (such as filling the array manually).