Skip to content

Instantly share code, notes, and snippets.

View desplesda's full-sized avatar

Jon Manning desplesda

View GitHub Profile
@desplesda
desplesda / Lock.yarn
Created April 1, 2024 03:15
Combination Lock for books.yarnspinner.dev
title: Start
---
// Paste this gist into https://books.yarnspinner.dev and click Download Book!
You hold in your hands a combination lock. Can you unlock it?
<<set $col1 = 0>>
<<set $col2 = 0>>
<<set $col3 = 0>>
@desplesda
desplesda / DebugTools.cs
Last active July 11, 2022 09:55
Unity Speedup Script
using UnityEngine;
// Speeds up the game's clock when a key is being held down. Extremely useful
// for skipping cutscenes, speeding up segments where the player walks to a
// destination, or any other place where you need to wait for something.
public class DebugTools : MonoBehaviour
{
[SerializeField] KeyCode speedUpKey = KeyCode.Tab;
[SerializeField] float speedMultiplier = 10f;
@desplesda
desplesda / RuntimeLoading.cs
Created March 8, 2021 03:23
Sample code for runtime compilation and loading of Yarn scripts in Yarn Spinner 1
class Demo : MonoBehaviour {
public DialogueRunner dialogueRunner;
private void LoadYarnFilesAndRun(string sourceFilesDirectoryPath)
{
Debug.Log($"Compiling and loading Yarn files in {sourceFilesDirectoryPath}");
var yarnFiles = Directory.EnumerateFiles(sourceFilesDirectoryPath, "*.yarn")
.Concat(Directory.EnumerateFiles(sourceFilesDirectoryPath, "*.yarn.txt"))
@desplesda
desplesda / UnityUI2019to2018.sed
Last active October 20, 2021 18:47
A sed script that fixes Unity UI component references when downgrading from 2019.3 to earlier versions.
# UnityUI2019to2018.sed
#
# Jon Manning (@desplesda) 2020
#
# Replaces instances of Unity UI components that refer to the package version of Unity UI (2019.3+), as opposed to the built-in version of Unity (2019.2 and earlier). Can be used on .prefab and .scene files.
#
# Usage: sed -f UnityUI2019to2018.sed SceneOrPrefab2019.unity > SceneOrPrefab2018.unity
# Button
s/m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}/m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, type: 3}/g
@desplesda
desplesda / CaptureEditorScreenshots.cs
Created January 29, 2020 01:31
Methods for capturing screenshots of the game view and the inspector in Unity (2018.3+)
// Drop these methods into a class in a folder named 'Editor'
[MenuItem("X/Capture Game &1")]
static void CaptureGameScreenshot()
{
EditorApplication.delayCall += () =>
{
var sceneName = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
@desplesda
desplesda / Fastfile
Last active March 29, 2021 18:53
An example of the Fastfile used to automate builds of Night in the Woods.
# This Fastfile uses the u3d gem to control Unity. You can find it at:
# https://github.com/DragonBox/u3d
# This is the minimum version number required.
# Update this, if you use features of a newer version
fastlane_version "2.117.1"
fastlane_require 'spaceship'
@desplesda
desplesda / PropLinePlacer.cs
Last active May 9, 2019 12:02
PropLinePlacer - a tool for placing lines of prefabs! Video: https://twitter.com/desplesda/status/1126410852658106368
// PropLinePlacer - a tool for placing lines of prefabs
// By Jon Manning
// MIT License
// Copyright (c) 2019 Secret Lab Pty Ltd
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
@desplesda
desplesda / readme.txt
Created December 16, 2018 01:37
Button Squid (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@desplesda
desplesda / readme.txt
Created December 15, 2018 22:45
Button Squid (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@desplesda
desplesda / readme.txt
Created December 15, 2018 22:38
Button Squid (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html