inkle / inkle/ink

Unity Integration Null Exception Error

Open
#363 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
4.9k
Forks
540
PR merge metrics
No merged PRs in 30d

Description

I've been getting a null reference exception from story.Continue pointing to the following line of Story.

Story.cs at 597
```
if (choicePoint.hasStartContent) {
var startStrVal = state.PopEvaluationStack () as StringValue;
startText = startStrVal.value; //Here's the null reference exception.
}
```

Here's the relevant content from my .ink

```
VAR Red = 0

VAR Green = 0

VAR Blue = 0

VAR Energy = 0

== Quest1 ==
= Lead
Quest 1 Lead #GoToQuest-Quest1.Begin //#FindQuest-Quest1.Begin
* Jump to Begin
** With Reward #Reward-10/10/10/1
** Without Reward
-- ->Begin
* Here we go[ I guess]!
* [Might as well]
- -> DONE
= Begin
Quest 1 Start
You have {Red}, {Green}, {Blue}, and {Energy}.
Can you pay?
* I'll pay, I'll pay.
-> End
+ {canAfford(1, 1, 1, 0)} I can pay! //If this returns false, we seem to be fine.
-> End
+ Too Bad I'm broke!
"That's unacceptable!" -> Begin
-> DONE
= End
Quest 1 Ending #Reward-10/10/10/1
-> DONE

=== function canAfford(r, g, b, e) ===
{ (r < Red && g < Green && b < Blue && e < Energy):
~ Red -= r
~ Green -= g
~ Blue -= b
~ Energy -= e
~ return true
- else:
~ return false
}

```

SOLVED (maybe?):

```
~Red -= r //Seems to cause the issue
~Red = Red - r //Does not
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.