When a project is first imported, InputSystem.actions
will always return null
if it is set to a custom asset.
This is fixed when the Unity Editor is re-opened a second time. On CI, though, we don’t have this option, so this error is more challenging to work around.
Further Information:
Although the asset reference is set, on first import the Project Settings shows an empty field:
After re-opening Unity, the correct asset is shown:
I think this may have to do with asset import order. Perhaps the Input Actions Asset in our project is imported after Project Settings are resolved?
Re-adding the custom asset also fixes the problem, however it does not change anything on disk. So this seems to be a case where the serialized project settings on disk are out of sync with the in-memory object.
I can submit a bug report if that would be helpful, or if you can suggest a workaround to try.