inkle / inkle/ink

Variable observers (and other ways of moving data between unity and the story)

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

Description

In my planned game, on the Unity side there are a number of systems to do with character generation, battle, tech trees and so on. These systems get pretty heavy with some calculations I don't believe Ink is capable of, and they need access to pretty much all the variables to get and set them. So it makes sense to store the game state here.

But on the Ink side (which I'm using for missions and end of turn events), the story also needs access to pretty much the same stuff. Some choices only appear if certain conditions are met. And almost everything can be changed by your choices in the story.

Does anyone have any thoughts about the possibility / best way of sharing all the needed data between the unity side and story side?

Are variable observers part of the answer?
How do they work?
The documentation says:

> You can register a delegate function to be called whenever a particular variable changes.

Which I don't understand.

Do I simply put the following in the update method?:
```
_inkStory.ObserveVariable ("health", (string varName, object newValue) => {
SetHealthInUI((int)newValue);
});
```
...or do I also have to do something with functions on the Ink side?

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.