inkle / ink-unity-integration

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

Recompiling Ink changes json syntax to make files unusable in Unity (without tedious edits) #203

Open sopeculiar opened 1 month ago

sopeculiar commented 1 month ago

Unity requires me to Recompile Ink when I make edits to the ink files. However, this reformats my jsons from version 20 to 21 and alters the syntax, making them unreadable by Unity without manually editing each file.

Here's the json after a recompile:

Screenshot 2024-07-08 at 3 20 50 PM

And the edits I made to fix it:

Screenshot 2024-07-08 at 3 21 42 PM

What can I do to prevent this in the future? It makes editing dialogue in our game a huge pain. TIA.

tomkail commented 1 month ago

Hi! I’m not sure I see the issue? The plugin should play json files of the same version that it compiles to. You shouldn’t ever really need to look at the json files. Can you explain what you mean again?

On Mon, 8 Jul 2024 at 20:25, SoPeculiarGames @.***> wrote:

Unity requires me to Recompile Ink when I make edits to the ink files. However, this reformats my jsons from version 20 to 21 and alters the syntax, making them unreadable by Unity without manually editing each file.

Here's the json after a recompile: Screenshot.2024-07-08.at.3.20.50.PM.png (view on web) https://github.com/inkle/ink-unity-integration/assets/26007000/c2c69f69-6ac0-4365-9635-cfc75555a112

And the edits I made to fix it: Screenshot.2024-07-08.at.3.21.42.PM.png (view on web) https://github.com/inkle/ink-unity-integration/assets/26007000/3fc6900b-ab75-49be-8ab1-a3d20e758127

What can I do to prevent this in the future? It makes editing dialogue in our game a huge pain. TIA.

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

sopeculiar commented 1 month ago

Hey, thanks for the response! The repro steps would be:

The only fix I know of is to edit the json files after recompiling, though I would certainly rather not. :)

tomkail commented 1 month ago

You absolutely shouldn’t need to change the json files. When you say compile ink, how are you doing that? Unity ought to do it automatically for all ink files in your project. You shouldn’t need to compile manually. Are your ink files in your Unity project?

On Thu, 11 Jul 2024 at 21:18, SoPeculiarGames @.***> wrote:

Hey, thanks for the response! The repro steps would be:

  • Dialogue is playing just fine in the editor and in builds
  • Find a typo
  • Fix it in the Ink file and save
  • Attempt to build in Unity
  • Get an error that is necessary to recompile Ink
  • Recompile Ink
  • Play the build: no dialogue plays for any character

The only fix I know of is to edit the json files after recompiling, though I would certainly rather not. :)

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

sopeculiar commented 1 month ago

They are in the Unity project. Unity is not compiling automatically. It just gives me an error that it needs to be done before it will build. So I use this option under Assets:

Screenshot 2024-07-11 at 4 41 42 PM
tomkail commented 1 month ago

Gotcha. It ought to - can you check your ink Settings in Project Settings? It’s possible auto compilation is off? What is the error you get?

On Thu, 11 Jul 2024 at 21:43, SoPeculiarGames @.***> wrote:

They are in the Unity project. Unity is not compiling automatically. It just gives me an error that it needs to be done before it will build. So I use this option under Assets: Screenshot.2024-07-11.at.4.41.42.PM.png (view on web) https://github.com/user-attachments/assets/f378fd7f-047f-43ed-a95a-5277f1afcd38

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

sopeculiar commented 1 month ago

I was just looking at that. Here's what I've got.

Screenshot 2024-07-11 at 4 44 04 PM

Would it have updated automatically at some point? The previous files in the JSON were version 20, and they changed to 21 after the recompile. It seemed like that was when the problem began. I've been using Ink in this project for almost 2 years, and the problem only began a few months ago.

sopeculiar commented 1 month ago

I just did a test, and it auto-compiled, but the dialogue isn't being read. It pops up as empty. Here's the beginning of the JSON file after the auto-compile. I think it's not reading the speaker tag correctly?

Screenshot 2024-07-11 at 4 48 53 PM
tomkail commented 1 month ago

Hmmm. Are you on the latest version of the plugin? If so, share your ink and I’ll have a look!

On Thu, 11 Jul 2024 at 21:52, SoPeculiarGames @.***> wrote:

I just did a test, and it auto-compiled, but the dialogue isn't being read. It pops up as empty. Here's the beginning of the JSON file after the auto-compile. I think it's not reading the speaker tag correctly? Screenshot.2024-07-11.at.4.48.53.PM.png (view on web) https://github.com/user-attachments/assets/d9d7b12f-23f3-48dd-b2f6-1b92b49394bb

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

sopeculiar commented 1 month ago

I am on the latest version. How do I share the Ink? Add an attachment here?

tomkail commented 1 month ago

That’ll be fine! Ta!

On Thu, 11 Jul 2024 at 21:57, SoPeculiarGames @.***> wrote:

I am on the latest version. How do I share the Ink? Add an attachment here?

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

tomkail commented 1 month ago

By the way - whan you say the version changes from 20 to 21 - what is compiling to version 20 and what is compiling to 21?

On Thu, 11 Jul 2024 at 22:22, Tom Kail @.***> wrote:

That’ll be fine! Ta!

On Thu, 11 Jul 2024 at 21:57, SoPeculiarGames @.***> wrote:

I am on the latest version. How do I share the Ink? Add an attachment here?

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

sopeculiar commented 1 month ago

I'm attaching an Ink file here for you. It's a part of a larger project, so let me know if you need to see more.

As for the compiling version. When everything was working smoothly, it was compiling to version 20. I would make changes, it would not usually auto-compile, but that was fine, because I could just manually do it in 3 seconds. Then at some point (can't remember exactly), I compiled and the dialogue would no longer play. I checked the changes to the Ink and JSON files. The differences were in the version number and the syntax of the beginning of the JSON file. All the Ink JSON files had been changed to version 21. Keeping the version number at 21 seems to work fine, as long as I edit the beginning of the JSONs so that it reads the speaker tag, but editing every JSON file each time I make a change is not a great solution.



On Jul 11, 2024, at 5:28 PM, Tom Kail @.***> wrote:

By the way - whan you say the version changes from 20 to 21 - what is compiling to version 20 and what is compiling to 21?

On Thu, 11 Jul 2024 at 22:22, Tom Kail @.***> wrote:

That’ll be fine! Ta!

On Thu, 11 Jul 2024 at 21:57, SoPeculiarGames @.***> wrote:

I am on the latest version. How do I share the Ink? Add an attachment here?

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

— Reply to this email directly, view it on GitHub https://github.com/inkle/ink-unity-integration/issues/203#issuecomment-2223969214, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGGNLWFH6ND24ETUPOL2MSLZL32IXAVCNFSM6AAAAABKROBZZ2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRTHE3DSMRRGQ. You are receiving this because you authored the thread.

tomkail commented 1 month ago

Hi! I can't see the file, annoyingly. Can you reupoad it? Before that though - I've just updated the package - can you possibly try the latest version?

sopeculiar commented 1 month ago

I updated the package, but the problem persists. :( Trying another method of attaching the files. I can't upload an ink file here, but I copy/pasted the content into a txt. The JSON is also attached.

Charlotte.json Charlotte.txt

Feel free to email me at chera@sopeculiar.com if you want to talk through anything in detail or screenshare. I'd love to fix this!

sopeculiar commented 1 month ago

I did a little more testing. I think the problem is how it's parsing the speaker tag. I can move the speaker tag and get the file working again, but it won't read the speaker's name unless I change the JSON.