The new Unity Input system recently got it's first stable release. Any info about how to use it with Ork?
  • Currently only via the Custom input origin and probably a custom class that handles that for you.

    I've taken a first look into the new system, but so far I don't really see the benefit in using it (with ORK). Might be that this will not be available in ORK 2 and be part of ORK 3.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I'd love to chime in here and ask if there's an example of using the new input system via the Custom Input origin?

    Or maybe if someone knows where the script is that holds the actual functions for the action inputs? I haven't been able to locate a file with the static functions returning a float that I recognize. I'm referring here to the script that is generated when you make an input action map and use the "Generate C# Class" option in the inspector window.

    On the ORK side it seems simple enough, but not on the input system side. Granted, I'm not well-versed in coding, finding a function that returns a float seems like a simple task. Any help is appreciated.
  • I think the new input system is code-wise somewhat of a mess.

    If you want to use ORK's Custom input origin for it, you'll have to write a custom class with the needed static methods that access the new input system's code/asset.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks for that info GiL. Time to level up my coding skill and get this working.
  • So with the help of one the coders on my team I was able to get the custom control script functioning the way it should. Now I'm just left with one of two problems to resolve which hinge on a particular setting. In Project Settings>Player>Other Settings there is a setting labeled "Active Input Handling*" you have the option to use one of these three:

    Input Manager (Old)
    Input System Package (New)
    Both

    We're of course using the New Input System. So problems...

    Scenario 1
    If we keep the Input System Package setting selected, when we run the game we don't get the main menu (which is auto-called), controls don't respond, and we get just one error:

    "InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings.
    UnityEngine.Input.get_mousePosition () (at <2db13ba0d52343228aa9892c408fb49a>:0)
    ORKFramework.ControlHandler.UpdateMousePosition () (at :0)
    ORKFramework.ORKCore.FireTick () (at <269d7a4de1ab48068e7acd23f753e118>:0)
    ORKFramework.ORKHandler.Update () (at <269d7a4de1ab48068e7acd23f753e118>:0)"

    Scenario 2
    If we change the setting to 'Both' and run the game, the game runs, the Main Menu pops up (albeit with no text appearing), the cursor pops up, but the controls still don't respond. We get no errors, but ORK spits warnings that all look like this:

    "Method not found (CustomOrkControls): OnAttackInteract
    UnityEngine.Debug:LogWarning(Object)
    ORKFramework.Reflection.CallMethod:GetReturnValueStatic(String)
    ORKFramework.InputKey:Tick()
    ORKFramework.InputKeysSettings:Tick()
    ORKFramework.ORKCore:FireTick()
    ORKFramework.ORKHandler:Update()"

    At the moment I'm stumped. I figure that I missed something in my script for the second scenario, but I'm also wondering if there's an easy fix for the first scenario. Any ideas?
  • Since ORK's code includes references to the old input system, using an option that removes it from the project will cause issues, so I'd recommend using Both option if you're using the new input system.

    As for the error/warning you're getting when using that option - this means that ORK isn't able to call your custom function, probably due to your custom control setup in ORK not being correct.
    How does the setup for your custom control look in ORK and what's your class and function names?
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited August 21
    Yeah, I tried looking for the scripts I was getting errors about, but they're all .dll so I went back to Both and left it there.

    As for the custom controls here's the ORK setting:
    https://drive.google.com/file/d/14f3SajvNXxJ6Hd7SAK_EyNyHzDlHQM4p/view?usp=sharing

    And here's the code:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.InputSystem;

    public class CustomOrkControls : MonoBehaviour
    {
    public InputActionAsset actionAsset;

    //trying to return either static float or bool values from the new input system

    // With Methods that return a value (such as the float below), you have put the variable you want returned immediately after "return". Anything after "return" won't be executed.
    public static float OnHorizontalMove(InputAction.CallbackContext context)
    {
    return context.ReadValue<float>();
    }

    public static float OnVerticalMove(InputAction.CallbackContext context)
    {
    return context.ReadValue<float>();
    }
    // For Methods that are defined as returning "void" (which don't return anything), we can't invoke "return". We have to change the "void" to a "float".
    // Since we are returning the Vector2's x value, we don't need to return a "new" float, just the float that already exists.
    public static float OnLookX(InputAction.CallbackContext context)
    {
    return context.ReadValue<Vector2>().x;
    }

    public static float OnLookY(InputAction.CallbackContext context) => context.ReadValue<Vector2>().y;

    // Again, the format for returning a variable on a callback is as below:
    public static bool OnAttackInteract(InputAction.CallbackContext context)
    {
    return context.ReadValue<bool>();
    }

    public static bool OnJump(InputAction.CallbackContext context)
    {
    return context.ReadValue<bool>();
    }

    public static bool OnCancelSheathe(InputAction.CallbackContext context)
    {
    return context.ReadValue<bool>();
    }

    public static bool OnGrabCharge(InputAction.CallbackContext context)
    {
    return context.ReadValue<bool>();
    }

    public static bool OnActivateSiddhi(InputAction.CallbackContext context)
    {
    return context.ReadValue<bool>();
    }

    public static bool OnDash(InputAction.CallbackContext context)
    {
    return context.ReadValue<bool>();
    }

    public static bool OnGuardScope(InputAction.CallbackContext context)
    {
    return context.ReadValue<bool>();
    }

    public static bool OnSecondaryAttack(InputAction.CallbackContext context)
    {
    return context.ReadValue<bool>();
    }

    public static bool OnStealth(InputAction.CallbackContext context)
    {
    return context.ReadValue<bool>();
    }

    public static bool OnPOVChange(InputAction.CallbackContext context)
    {
    return context.ReadValue<bool>();
    }

    public static bool OnCharacterMenu(InputAction.CallbackContext context)
    {
    return context.ReadValue<bool>();
    }

    public static bool OnGameMenu(InputAction.CallbackContext context)
    {
    return context.ReadValue<bool>();
    }

    public static bool OnCycleSiddhi(InputAction.CallbackContext context)
    {
    return context.ReadValue<bool>();
    }

    public static bool OnWpnSwitchL(InputAction.CallbackContext context)
    {
    return context.ReadValue<bool>();
    }

    public static bool OnWpnSwitchR(InputAction.CallbackContext context)
    {
    return context.ReadValue<bool>();
    }

    public static bool OnRestMenu(InputAction.CallbackContext context)
    {
    return context.ReadValue<bool>();
    }
    }
    Post edited by dragoonleaph on
  • Yeah, that's not going to work :)

    Your setup in ORK expects a function without any parameters, but your function requires a InputAction.CallbackContext parameter, which you can't add via ORK.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Thanks GiL, my team decided it was best to go with Rewired. I got Rewired working in 3 days, between a host of other tasks, as opposed to the 3 weeks it took to bang my head against the wall with the New Input System.

    Good lesson in both coding and futility.
Sign In or Register to comment.