[SerializeField]
private InputActionAsset inputAsset;
private RoastsInput.RoastMapActions roastInput;
I don’t know where/how to initialize roastInput
(the auto-generated class from the InputActionAsset) so that I can use it to compare it to the context, like attempted below:
public void OnSkillUse(InputAction.CallbackContext context)
{
if (context.performed)
{
if (context.action == roastInput.UsePrimarySkill)
{
Debug.Log("Primary Skill");
}
}
}
Is there a better way of doing this?
Managed to achieve somewhat what I needed doing:
private RoastsInput roastInput;
private void Awake()
{
roastInput = new RoastsInput();
primaryID = roastInput.RoastMap.UsePrimarySkill.id;
secondaryID = roastInput.RoastMap.UseSecondarySkill.id;
}
But it looks bad to me… Why would I call new on something that is know and it wont change before runtime? Those Guid (ID’s) don’t seem to change (ran the code several times and those numbers don’t change from one execution to the next), so could I just look them up before runtime and save them somewhere?
It simply seems like a lot of work to get that info at runtime when clearly is know beforehand… Would aprecciate some insight on this. Thanks!