I'm trying to use PriorityQueue
in Unity with C#. The documentation says that it's supported in .NET 6 in namespace System.Collections.Generic
.
I've tried:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
public class Test : Monobehaviour
{
void Start()
{
var queue = new PriorityQueue<int, int>();
}
}
But an error is thrown back:
The type or namespace name 'PriorityQueue<,>' could not be found (are you missing a using directive or an assembly reference?) [Assembly-CSharp]
I've checked the .NET version within VS Code:
Why doesn't it work in Unity?
dotnet
from a prompt doesn't prove much. – Hyposensitize.csproj
file<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
. This is the problem? – Institutional.csproj
, not the new-style (that usesTargetFramework
andTargetFrameworks
, and is a lot shorter besides). I'm not sure Unity even has support for .NET Core (yet), which 6 is, but that's another question. – HyposensitizeSortedList
orSortedDictionary
using a tuple that includes the priority and an ID for uniqueness, with only the priority used for sorting through a custom comparer). – Hyposensitize