Skip to content

Data and Events framework for Unity. πŸ₯ƒβš‘

License

Notifications You must be signed in to change notification settings

faster-games/whiskey

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Whiskey

Data and Events framework for Unity. πŸ₯ƒβš‘

Project logo; A pink package on a grey background, next to the text "Whiskey" in purple

GitHub package.json version openupm CI Discord

Whiskey is a framework for managing data and events within Unity. It leans heavily on ScriptableObject, and is inspired by Ryan Hipple's Unite 2017 Talk. Whiskey lets game designers own and edit data definitions while programmers continue to evolve code - Whiskey brings the two together with references, to reduce merge conflicts.

Goals:

  • Create, Edit, and Visualize data within the Editor, not code.
  • Encourage decoupling, by using asset references rather than singletons.
  • Quickly swap between data constants and references without rewriting code.

Features:

Installing

This package supports openupm - you can install it using the following command:

openupm add com.faster-games.whiskey

Or by adding directly to your manifest.json:

Note: You may also use specific versions by appending #{version} where version is a Release tag - e.g. #v1.2.0.

dependencies: {
	...
	"com.faster-games.whiskey": "git+https://github.com/faster-games/whiskey.git"
}

Or by using Package Manager to "Add a package from Git URL", using the following url:

https://github.com/faster-games/whiskey.git

Documentation

Manual πŸ“– | Scripting API πŸ”Ž

Quickstart

Disclaimer: By nature, Whiskey isn't easy to demonstrate. As such, this may not be as "quick" as you'd expect! πŸ˜…

  • Right click in the Project Window select: Create, Whiskey, Boxes, Int
  • Name the created data instance
  • Select the data instance
  • Edit the data in the Inspector Window
  • Right click in the Project Window select: Create, C# Script
  • Name the created script IntTestBehaviour
  • Edit the script, adding the following:
using FasterGames.Whiskey.Boxes;
using UnityEngine;

public class IntTestBehaviour : MonoBehaviour
{
    public Ref<int> intRef;

    private void Start()
    {
        Debug.Log(intRef.Value);
    }
}
  • Right click in the Hierarchy Window select: Create Empty
  • Name the created object
  • Select the object in the Hierarchy Window, then in the Inspector Window select Add Component and search for IntTestBehaviour, selecting the first result (which should be the script you created above)
  • Note the Int Ref field is displayed, by default it is a Direct reference. A direct reference is effectively a hard coded value.
  • Select the Direct dropdown, and change it to Boxed. Note the field changes, allowing you to drag and drop an object reference, and showing an additional dropdown field.
  • Ensure the additional dropdown field is set to BoxedInt, which will allow the editor to more accurately assist you in selecting the object.
  • Click the object reference field, and select the data instance you created above.
  • You have now made your first data reference using Whiskey. Run the code, and note that the value stored in your data instance is logged by the IntTestBehaviour script on Start.

πŸš€πŸš€πŸš€ Thanks for bearing with us! There's a lot of features in Whiskey, this quickstart only demonstrates one. To learn more, see The manual.

Supporting the project

If this project saved you some time, and you'd like to see it continue to be invested in, consider buying me a coffee. β˜• I do this full-time, and every little bit helps! πŸ’™