Manual initialization : System.ArgumentException: Input Axis Mouse ScrollWheel is not setup.

Posted: 03 Jan 2022 17:24
by JohnDoe

Hello.
I am a Japanese user.
This question is also posted using DeepL, so I apologize for the poor English.

I'm currently thinking of using Naninovel for my game conversations.
As a first step, I tried to initialize it manually and load NaniScript from C#.

I used a Japanese site for reference.
However, I got an error and it does not work well.
I don't even know what the problem is, and I'm in trouble.
Can you please help me?

The error message is as follows.

System.ArgumentException: Input Axis Mouse ScrollWheel is not setup.
To change the input settings use: Edit -> Settings -> Input
at (wrapper managed-to-native) UnityEngine.Input.GetAxis(string)
at Naninovel.InputAxisTrigger.Sample () [0x00013] in D:\unitygame\CorgiEngine_Study_Project\Assets\Naninovel\Runtime\Input\InputAxisTrigger.cs:25
at Naninovel.InputSampler.<SampleInput>g_SampleAxes|43_1 () [0x00020] in D:\unitygame\CorgiEngine_Study_Project\Assets\Naninovel\Runtime\Input\InputSampler.cs:122
at Naninovel.InputSampler.SampleInput () [0x00061] in D:\unitygame\CorgiEngine_Study_Project\Assets\Naninovel\Runtime\Input\InputSampler.cs:100
at Naninovel.InputManager.SampleInputAsync (System.Threading.CancellationToken cancellationToken) [0x000bc] in D:\unitygame\CorgiEngine_Study_Project\Assets\Naninovel\Runtime\Input\InputManager.cs:168
UnityEngine.Debug:LogError (object)
Naninovel.Async.UniTaskScheduler:PublishUnobservedTaskException (System.Exception) (at Assets/Naninovel/Runtime/Common/Async/UniTask/UniTaskScheduler.cs:65)
Naninovel.Async.CompilerServices.AsyncUniTaskVoidMethodBuilder:SetException (System.Exception) (at Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/AsyncUniTaskVoidMethodBuilder.cs:29)
Naninovel.InputManager/<SampleInputAsync>d_24:MoveNext () (at Assets/Naninovel/Runtime/Input/InputManager.cs:156)
Naninovel.Async.CompilerServices.MoveNextRunner`1<Naninovel.InputManager/<SampleInputAsync>d__24>:Run () (at Assets/Naninovel/Runtime/Common/Async/UniTask/CompilerServices/MoveNextRunner.cs:16)
Naninovel.Async.Internal.ContinuationQueue:RunCore () (at Assets/Naninovel/Runtime/Common/Async/UniTask/Internal/ContinuationQueue.cs:193)
Naninovel.Async.Internal.ContinuationQueue:EarlyUpdate () (at Assets/Naninovel/Runtime/Common/Async/UniTask/Internal/ContinuationQueue.cs:153)
Naninovel.Async.Internal.ContinuationQueue:Run () (at Assets/Naninovel/Runtime/Common/Async/UniTask/Internal/ContinuationQueue.cs:100)

The code I used is as follows
I attached the following code to an object from the game and ran the game.

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Naninovel;
public class nani_initTest : MonoBehaviour
{
    private int scriptCnt = 0;
    private bool nextFlag = false;
    private ScriptPlayer player = null;
    private string[] scriptList = new string[]
    {
    "StartScript", "SecondScript"
    };
    // Start is called before the first frame update
    void Start()
    {
        NaninovelInitial();
    }

async void NaninovelInitial()
{
    Debug.Log("test0");
    // 初期化完了のメッセージを表示。
    Engine.OnInitializationFinished += () =>
    {
        Debug.Log("Naninovel Initialize Complete.");
        nextFlag = true;
        player = Engine.GetService<ScriptPlayer>();
        player.OnStop += (Script script) =>
        {
            scriptCnt++;
            nextFlag = true;
        };
    };
    Debug.Log("test2");
    // ノベルシステムの初期化
    await RuntimeInitializer.InitializeAsync();
    Debug.Log("test1");
}
// Update is called once per frame
void Update()
{
    if (nextFlag)
    {
        nextFlag = false;
        if (scriptList.Length > scriptCnt)
        {
            PlayNaninovelMessage(scriptList[scriptCnt]);
        }
    }
}
async void PlayNaninovelMessage(string id)
{
    await player.PreloadAndPlayAsync(id);
}
}

Re: Manual initialization : System.ArgumentException: Input Axis Mouse ScrollWheel is not setup.

Posted: 03 Jan 2022 18:29
by Elringus

Hey, As mentioned in the error message, it's due to Mouse ScrollWheel input is not setup in the Unity input settings. It should be set by default in new projects, so you've probably removed or modified it. Here are the docs on input manager: https://docs.unity3d.com/ja/2018.4/Manu ... nager.html


Re: Manual initialization : System.ArgumentException: Input Axis Mouse ScrollWheel is not setup.

Posted: 04 Jan 2022 03:57
by JohnDoe

Hello.

I created a new project and tried it, and the aforementioned error disappeared.
Thank you very much.
However, I got the following new error.

Exception: Failed to load StartScript script: The resource is not available.

I think the error is "Cannot find NaniScript set in C#".
Where do I put the NaniScript data so that it will be recognized?

Sorry for the newbie question.