Ошибка при инициализации NativeHashMap

Я только начал работать с Jobs и столкнулся с проблемой при использовании NativeHashMap<int, Resource>. При попытке инициализировать этот словарь с помощью строки _nativeResourcesDict = new NativeHashMap<int, Resource>(resourceDictCount, Allocator.Persistent); мне выдается ошибка "ArgumentException: ResourceManager+Resource used in native collection is not blittable, not primitive, or contains a type tagged as NativeContainer". Я попытался заменить все переменные на одноэлементные NativeArray, но это не помогло. Изменено: структуру Resource починено.

public struct Resource
{
    public float positionX { get; set; }
    public float positionY { get; set; }
    public float targetPositionX { get; set; }
    public float targetPositionY { get; set; }
    public int lastDirection { get; set; }
}

Но есть ошибка с другой структурой в этом же коде, вот структура:

public struct PipeConnection
{
    public float positionX { get; set; }
    public float positionY { get; set; }
    public bool[] IsConnected { get; set; }
    public bool[] IsTemporarilyBlocked { get; set; }
    public bool IsBusy { get; set; }
    public int numOfNeighbors { get; set; }
    public int direction { get; set; }

    public PipeConnection(Vector3 pos, bool[] isCon, bool isBusy, int numNei, int dir)
    {
        positionX = pos.x;
        positionY = pos.y;
        IsConnected = isCon;
        IsTemporarilyBlocked = new bool[4];
        IsBusy = isBusy;
        numOfNeighbors = numNei;
        direction = dir;
    }

    public void SetValue(bool isBusy) => IsBusy = isBusy;

    public void SetValues(bool isBusy, int indexOfBlockedSide, bool isTemporarilyBlocked)
    {
        IsBusy = isBusy;
        IsTemporarilyBlocked[indexOfBlockedSide] = isTemporarilyBlocked;
    }

    public bool Equals(PipeConnection other)
    {
        if (positionX == other.positionX && positionY == other.positionY) { return true; }
        else return false;
    }
}

Ответы (0 шт):