Replies: 1 comment 1 reply
-
Is it possible that Its because the field is readonly? Remove it and try again :) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
EDIT: Sorry for the code formatting, Github seems to refuse to format it correctly.
Hello, I'm working on an InputManager for a custom engine for my game. Due to the lack of an UnsafeDirectory type, I've been using UnsafeLists to store the ID of an Action and the handles containing the references to the Actions themselves.
In the following example, calling AddAction() doesn't seem to properly register the key to the IDs list. Using a breakpoint in Visual Studio reveals the item is added to the underlying UnsafeArray<>, but the actual Count isn't increased. This causes a problem in the GetButtonEvent() method where the Contains() method always returns false as its Count stays at 0.
What's strange about this is that creating and UnsafeList<> directly inside the AddAction() method, and adding the key to it successfully increases its Count property; but doing it with one of the UnsafeList<> fields doesn't work.
I'm at a loss about what to do. Is it an oversight on my part? Any suggestion would be welcome.
`
using System;
using Arch.LowLevel;
using Retard.Core.Models.ValueTypes;
using Retard.Core.ViewModels.Input;
namespace Retard.Engine.Models.Assets.Input
{
internal readonly struct InputHandles
{
private readonly UnsafeList _buttonStateHandlesIDs;
private readonly UnsafeList _buttonStateHandles;
}
`
Beta Was this translation helpful? Give feedback.
All reactions