inkle / ink-unity-integration

Unity integration for the open source ink narrative scripting language.
http://www.inklestudios.com/ink
Other
570 stars 99 forks source link

null path and null currentPointer during the first line of a knot #189

Closed molleindustria closed 1 year ago

molleindustria commented 1 year ago

Hello everybody! Thank you so much for Ink (and inky). It's the best game making tool I've ever used and I'm building a big project around it. I've been banging my head against this bug or limitation. I don't know if it's due to ink or its Unity integration.

In some cases, after a story.continue() the path and the currentPointer are null, and there is no way to know where you are in the story, even if the story works fine.

Here's an example with nothing but debugging messages added to the Basic Demo. If you divert to a knot or a stitch made by a single line, the path is always null. If the knot is two lines, then the first line will have a path right after the continue. If the pointer is retrieved before the continue, it will be the id of the choice. Basically there is no state in which I get "c1" as pointer name or path. I understand that the path can be undefined if there are injections but this doesn't seem to be the case. It obviously knows where it is, but I guess something in the stack order overwrites the path before I can read it or waits to write it until the second line. Is there any workaround, any way to retrieve it?

nullpath ink

tomkail commented 1 year ago

Hi! I’m afraid paths don’t work in the way you might hope; they also don’t get set immediately on loading a save state. This is more of an issue with ink than the Unity plugin. That said, I actually made a branch to try to fix this a while ago - check out “currentContainerPathString”. I can’t recall how robust it was but it seemed to work last I checked. You can also see the current path in the Ink Player Window when using it, handy for debugging.

On Wed, 19 Jul 2023 at 00:00, Paolo Pedercini @.***> wrote:

Hello everybody! Thank you so much for Ink (and inky). It's the best game making tool I've ever used and I'm building a big project around it. I've been banging my head against this bug or limitation. I don't know if it's due to ink or its Unity integration.

In some cases, after a story.continue() the path and the currentPointer are null, and there is no way to know where you are in the story, even if the story works fine.

Here's an example with nothing but debugging messages added to the Basic Demo. If you divert to a knot or a stitch made by a single line, the path is always null. If the knot is two lines, then the first line will have a path right after the continue. If the pointer is retrieved before the continue, it will be the id of the choice. Basically there is no state in which I get "c1" as pointer name or path. I understand that the path can be undefined if there are injections https://github.com/inkle/ink-unity-integration/issues/38#issuecomment-326230174 but this doesn't seem the case. It obviously knows where it is, but I guess something in the stack order overwrites the path before I can read it or waits to write it until the second line. Is there any workaround, any way to retrieve it?

[image: nullpath ink] https://user-images.githubusercontent.com/12369651/254411506-017a876b-0512-459a-8eb3-86b0ff8e1c21.png

— Reply to this email directly, view it on GitHub https://github.com/inkle/ink-unity-integration/issues/189, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJR3UACDXWLPJRVD6JOAR3XQ4BP7ANCNFSM6AAAAAA2PAITOA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

molleindustria commented 1 year ago

Thank you for the prompt answer. It would be nice to have a variable that keeps track of the last node or stitch encountered. One may want audiovisual content in unity that mirrors the ink story, using the same identifiers. Right now I'm adding a function under every single stitch like:

= house ~path("house")

To tell unity where I am and it feels hella weird.

tomkail commented 1 year ago

I see! There’s lots of ways of solving that problem. Paths aren’t recommended because they don’t work like that without the patch in the branch. The solution of just telling unity in some way is pretty standard, but if you have a huge number of locations I can see how it might get annoying!

On Wed, 19 Jul 2023 at 14:59, Paolo Pedercini @.***> wrote:

Thank you for the prompt answer. It would be nice to have a variable that keeps track of the last node or stitch encountered. One may want audiovisual content in unity that mirrors the ink story, using the same identifiers. Right now I'm adding a function under every single stitch like:

= house ~path("house")

To tell unity where I am and it feels hella weird.

— Reply to this email directly, view it on GitHub https://github.com/inkle/ink-unity-integration/issues/189#issuecomment-1642039707, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJR3UDK4U6TD7A4CQARFCDXQ7K4BANCNFSM6AAAAAA2PAITOA . You are receiving this because you commented.Message ID: @.***>