Script won't load, unknown reason

Discuss authoring naninovel scenario scripts.
Post Reply
juan.delcastillo
Posts: 13
Joined: 02 Feb 2021 19:11

Script won't load, unknown reason

Post by juan.delcastillo »

My Unity project lets the player interact with the environment. When the mouse hovers over an interactive object, the mouse becomes a magnifier signaling that the player can click the item. When clicked, a Naninovel script starts.

Every interactive object has a C#script attached to it, called ObjectInteraction, that uses PreloadAndPlayAsync(scriptName), scriptName being a public string that is written in each object. The script player is declared as a public variable in a DirectorScript and accessed through ObjectInteraction

This works for every object except for one script. For some reason, it triggers an error:

UnobservedTaskException:System.Exception: Failed to load PubToKitchen script: The resource is not available.

Can someone help me, please? Sorry for saying it this way, but I'm on a team and I have to show a demo in two days

Here's the link with an image of the object that has to run PubToKitchen and the code of PubToKitchen

https://i.ibb.co/FY045S0/Puerta.png

Code: Select all

�Quieres ir a la cocina?
@choice Si goto:.Si
@choice No goto:.No
@stop
# Si
A
@hide Dialogue
@loadScene KitchenScene
@stop
# No
B
@hide Dialogue
@stop
idaot
Posts: 19
Joined: 01 Aug 2020 08:25

Re: Script won't load, unknown reason

Post by idaot »

Has the script been added to the Script Resources? If yes, then try re-adding it and name it something else if possible. If that doesn't work then try deleting Library folder, re-installing Naninovel and re-importing NaninovelData folder.

juan.delcastillo
Posts: 13
Joined: 02 Feb 2021 19:11

Re: Script won't load, unknown reason

Post by juan.delcastillo »

idaot wrote: 18 Feb 2021 10:24

Has the script been added to the Script Resources? If yes, then try re-adding it and name it something else if possible. If that doesn't work then try deleting Library folder, re-installing Naninovel and re-importing NaninovelData folder.

What are these Script resources? I do have a folder called Scripts

EDIT: I checked the Resource Provider section of the guide and I installed the Adressable System, as it is recommended to decrease build time anyway. Still don't work

idaot
Posts: 19
Joined: 01 Aug 2020 08:25

Re: Script won't load, unknown reason

Post by idaot »

You can read more about Scripts Resources here: https://naninovel.com/guide/getting-sta ... vel-script

Auto Add Scripts in the Scripts Cofiguration is enabled by default so scripts will be added automatically but in case you rename or delete a script, you need to make the necessary adjustments yourself.

juan.delcastillo
Posts: 13
Joined: 02 Feb 2021 19:11

Re: Script won't load, unknown reason

Post by juan.delcastillo »

Oh, it was that! I forgot about it. Thank you very much

Post Reply