This commit is contained in:
SoulliesOfficial
2026-06-09 11:21:59 -04:00
parent 7c60c40d6b
commit 021e76efe7
493 changed files with 50500 additions and 2211 deletions

View File

@@ -0,0 +1,5 @@
# These are supported funding model platforms
patreon: secretlab
github: YarnSpinnerTool
custom: ['https://yarnspinner.itch.io', 'https://assetstore.unity.com/packages/tools/behavior-ai/yarn-spinner-for-unity-the-friendly-dialogue-and-narrative-tool-267061']

View File

@@ -0,0 +1,25 @@
---
name: Bug report
about: Create a report to help us improve!
title: ''
labels: bug
assignees:
---
**What is the current behavior?**
<!-- Please describe what you're seeing. -->
**Please provide the steps to reproduce, and if possible a minimal demo of the problem**:
<!-- Please give us as much detail as you can, so that we can reproduce the issue. If possible, please consider uploading a demo project that demonstrates the problem. -->
**What is the expected behavior?**
<!-- What do you expect to see instead of what's happening now? -->
**Please tell us about your environment:**
- Yarn Spinner Version:
- Unity Version:
**Other information**
<!-- For example, a detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context... -->

View File

@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for Yarn Spinner!
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
**Describe the solution you'd like**
<!-- A clear and concise description of what you want to happen. -->
**Describe alternatives you've considered**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->

View File

@@ -0,0 +1,58 @@
* **Please check if the pull request fulfills these requirements**
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Does it pass all existing unit tests without modification?
- If not, what did you change?
- If you altered it significantly, what coverage issue did you fix?
- [ ] Docs have been added / updated (for bug fixes / features)
- [ ] CHANGELOG.md has been updated to describe this change
<!-- Please also consider adding yourself to CONTRIBUTORS.md as part of your pull request. We'd like to recognise you for your efforts! -->
<!-- To update the documentation on yarnspinner.dev, please submit a pull request to the documentation repository at https://github.com/YarnSpinnerTool/Docs. -->
* **What kind of change does this pull request introduce?**
- [ ] Bug Fix
- [ ] Feature
- [ ] Something else
* **What is the current behavior?**
<!-- If you are fixing a known bug, you can also link to an open issue here. -->
* **What is the new behavior (if this is a feature change)?**
<!-- Please describe, in as much detail as you can, what your pull request changes in Yarn Spinner. -->
* **Does this pull request introduce a breaking change?**
<!-- What changes might users need to make in their application due to this PR? -->
* **Other information**:
<!--
Ideas:
- Performance?
- Does this drastically change performance characteristics, or simply allow for optimizations?
- Does this performance involve:
- Disk access
- CPU time
- Memory layout optimization (Lx caching etc)
- Might there be a use case where you are encouraged to be unperformant by default?
- What optimizations did you consider but left out due to time and/or complexity?
- Usability?
- If your change is to a sample, is it accessible? We don't follow standards like WCAG but any easy wins should be taken.
- Does it make it easier to use our API? If not, what annoyance mitigations have you taken/considered?
- Who will be affected?
- Is this an internal change, or something meant to be consumed by the end user?
- If you add API changes, is it easily upgradable from the previous version?
- What indirect consequence might be annoying to the end user?
- For what reasons would you say this is justified? E.g. super annoying to use in the first place, tightening up undefined behavior etc.
- What do you think will be controversial, if any?
- How would you describe the cause of the problem and changes to non-technical users if at all possible?
Feel free to take any all or none of these points as relevant, though we recommend you read through each point. They're just to get you started!
-->

View File

@@ -0,0 +1,38 @@
<!-- RELEASE_TEMPLATE.md is not a formally supported file used by GitHub. This file is used by .github/workflows/release.yml to add a release notes preface. -->
Yarn Spinner is made possible by your generous patronage. Please consider supporting Yarn Spinner's development by [becoming a patron](https://patreon.com/secretlab), or by buying a copy of Yarn Spinner on [itch.io](https://yarnspinner.itch.io/yarn-spinner) or the [Unity Asset Store](https://assetstore.unity.com/packages/tools/behavior-ai/yarn-spinner-for-unity-267061)!
<a href="https://patreon.com/secretlab"><img width="200" src="https://user-images.githubusercontent.com/901768/71883373-6f40ff80-318a-11ea-9d3a-01f1f58cb39e.png"></a>
## 👩‍🚒 Getting Help
There are several places you can go to get help with Yarn Spinner.
* Join the [Yarn Spinner Discord](https://discord.gg/yarnspinner).
* Talk to us via [BlueSky](http://bsky.app/profile/yarnspinner.dev) or [Mastodon](https://team.yarnspinner.dev/@yarnspinner)
* To report a bug, [file an issue on GitHub](https://github.com/YarnSpinnerTool/YarnSpinner-Unity/issues/new?labels=bug+beta&template=bug_report.md&title=).
## 📦 How To Install Yarn Spinner
To install the most recent release of Yarn Spinner for Unity, please see the [Installation Instructions](https://docs.yarnspinner.dev/using-yarnspinner-with-unity/installation-and-setup) in the Yarn Spinner documentation.
If you want to install _this_ particular version of Yarn Spinner for Unity, follow these steps:
<details>
<summary>Installing Yarn Spinner for Unity {RELEASE_TAG} from Git</summary>
<p>
* Open the Window menu, and choose Package Manager.
* If you already have any previous version of the Yarn Spinner package installed, remove it.
* Click the `+` button, and click *Add package from git URL...*
* Enter the following URL:
* `https://github.com/YarnSpinnerTool/YarnSpinner-Unity.git#{RELEASE_TAG}`
Each release will have a different URL. To upgrade to future versions of Yarn Spinner, you will need to uninstall the package, and reinstall using the new URL.
</p>
</details>
## 📜 Changes

View File

@@ -0,0 +1,51 @@
#!/bin/bash
# Get info about the current commit
most_recent_tag=$(git describe --tags --match="v*" --abbrev=0)
commits_since_tag=$(git rev-list $most_recent_tag..HEAD | wc -l | awk '{$1=$1};1')
sha=$(git log -1 --format=%H)
short_sha=$(git log -1 --format=%h)
branch=$(git rev-parse --abbrev-ref HEAD)
# A regex for extracting data from a version number: major, minor, patch,
# [prerelease]
REGEX='v(\d+)\.(\d+)\.(\d+)(-.*)?'
raw_version=${1:-"$most_recent_tag"}
# Extract the data from the version number
major=$(echo $raw_version | perl -pe "s|$REGEX|\1|" )
minor=$(echo $raw_version | perl -pe "s|$REGEX|\2|" )
patch=$(echo $raw_version | perl -pe "s|$REGEX|\3|" )
prerelease=$(echo $raw_version | perl -pe "s|$REGEX|\4|" )
# Calculate the semver from the version (should be the same as the version, but
# just in case)
SemVer="$major.$minor.$patch$prerelease"
# If there are any commits since the current tag and we aren't overriding our
# version, add that note
if [ "$commits_since_tag" -gt 0 -a -z "$1" ]; then
SemVer="$SemVer+$commits_since_tag"
fi
# Create the version strings we'll write into the AssemblyInfo files
OutputAssemblyVersion=$(echo "$major.$minor.$patch.$commits_since_tag" | perl -pe "s|\/|\\\/|" )
OutputAssemblyInformationalVersion=$(echo "$SemVer.Branch.$branch.Sha.$sha" | perl -pe "s|\/|\\\/|" )
OutputAssemblyFileVersion=$(echo "$major.$minor.$patch.$commits_since_tag" | perl -pe "s|\/|\\\/|" )
# Update the AssemblyInfo.cs files
for infoFile in $(find . -name "AssemblyInfo.cs"); do
perl -pi -e "s/AssemblyVersion\(\".*\"\)/AssemblyVersion(\"$OutputAssemblyVersion\")/" $infoFile
perl -pi -e "s/AssemblyInformationalVersion\(\".*\"\)/AssemblyInformationalVersion(\"$OutputAssemblyInformationalVersion\")/" $infoFile
perl -pi -e "s/AssemblyFileVersion\(\".*\"\)/AssemblyFileVersion(\"$OutputAssemblyFileVersion\")/" $infoFile
done
# If we're running in GitHub Workflows, output our calculated SemVer
if [[ -n $GITHUB_OUTPUT ]]; then
echo "SemVer=$SemVer" >> "$GITHUB_OUTPUT"
echo "ShortSha=$short_sha" >> "$GITHUB_OUTPUT"
fi
# Log our SemVer
echo $SemVer

View File

@@ -0,0 +1,13 @@
#/bin/bash
if [ ! -d ".git" ]; then
echo "This script must be run in the root of the repository."
exit 1
fi
VERSION=$(.github/get-version.sh $@)
jq ".version=\"$VERSION\"" package.json > package.json.tmp
mv package.json.tmp package.json
echo "Updated package version to $VERSION"

View File

@@ -0,0 +1,102 @@
name: Run Tests on Broad Version Range 🌶
env:
ACTIONS_RUNNER_DEBUG: true
ACTIONS_STEP_DEBUG: true
on:
workflow_dispatch:
jobs:
buildAndTestForSomePlatforms:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true # Cancel other jobs if another one arrives
name: Test on ${{ matrix.unityVersion }} for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 1 # Only run one at a time, to prevent license contention
matrix:
projectPath:
- YarnSpinner
unityVersion:
- 2021.3.0f1
- 2021.3.32f1
- 2022.1.0f1
- 2022.1.24f1
- 2022.2.0f1
- 2022.2.21f1
- 2022.3.0f1
- 2022.3.13f1
- 2023.1.0f1
- 2023.1.20f1
targetPlatform:
# - StandaloneOSX # Build a macOS standalone (Intel 64-bit).
- StandaloneWindows64 # Build a Windows 64-bit standalone.
# - StandaloneLinux64 # Build a Linux 64-bit standalone.
# - iOS # Build an iOS player.
# - Android # Build an Android player.
# - WebGL # WebGL.
steps:
- name: Create empty Unity project
run: |
mkdir -p ${{ matrix.projectPath }}/Assets
mkdir -p ${{ matrix.projectPath }}/ProjectSettings
mkdir -p ${{ matrix.projectPath }}/Packages
# Add the Unity Input System package, and configure the new project to use
# both the Input System and the legacy Input Manager.
- name: Add Input System package
run: |
cat <<EOF > ${{ matrix.projectPath }}/ProjectSettings/ProjectSettings.asset
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!129 &1
PlayerSettings:
activeInputHandler: 2
EOF
cat <<EOF > ${{ matrix.projectPath }}/Packages/manifest.json
{
"dependencies": {
"com.unity.inputsystem": "1.0.2"
}
}
EOF
- name: Check out to Packages/YarnSpinner
uses: actions/checkout@v2
with:
fetch-depth: 0
path: ${{ matrix.projectPath }}/Packages/YarnSpinner
- name: Fetch from Cache
uses: actions/cache@v2
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}-${{ matrix.unityVersion }}-${{ hashFiles(matrix.projectPath) }}
restore-keys: |
Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}-${{ matrix.unityVersion }}-
- name: Run tests
uses: game-ci/unity-test-runner@v4
id: testRunner
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
with:
projectPath: ${{ matrix.projectPath }}
unityVersion: ${{ matrix.unityVersion }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
checkName: 'Test Results ${{ matrix.unityVersion }}-${{ matrix.targetPlatform }}'
# customParameters: -quit
- name: Upload test results
uses: actions/upload-artifact@v2
if: always()
with:
name: Test results (edit + play, ${{ matrix.unityVersion }}-${{ matrix.targetPlatform }}
# path: ${{ steps.testRunner.outputs.artifactsPath }}
path: artifacts

View File

@@ -0,0 +1,37 @@
name: Create Release 📦
on:
push:
tags:
- "*.*.*"
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
- name: Read release notes preface
id: release_preface
uses: bluwy/substitute-string-action@v1
with:
_input-file: .github/RELEASE_TEMPLATE.md
_format-key: '{key}'
RELEASE_TAG: ${{ github.ref_name }}
- name: Create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true
prerelease: true
body: |
${{ steps.release_preface.outputs.result }}
${{ steps.extract-release-notes.outputs.release_notes }}

View File

@@ -0,0 +1,157 @@
name: Run Tests 🧪
env:
ACTIONS_RUNNER_DEBUG: true
ACTIONS_STEP_DEBUG: true
on:
push:
branches:
- main
- "feature/**"
- "release/**"
paths:
- "Editor/**"
- "Runtime/**"
- "Samples~/**"
- "Tests/**"
workflow_dispatch:
jobs:
buildAndTestForSomePlatforms:
concurrency:
group: ${{ github.workflow }}-${{ matrix.unityVersion }}-${{ matrix.unityLocalisation }}-${{ matrix.uniTask }}
cancel-in-progress: true # Cancel other jobs if another one arrives
name: ${{ matrix.unityVersion }} (${{ matrix.targetPlatform }}, ${{ matrix.unityLocalisation && 'with unity loc' || 'no unity loc' }}, ${{ matrix.uniTask && 'with unitask' || 'no unitask' }})
runs-on: [self-hosted, linux]
strategy:
fail-fast: false
# max-parallel: 1 # Only run one at a time, to prevent license contention
matrix:
projectPath:
- YarnSpinner
unityVersion:
- 2022.3.45f1
- 2023.2.12f1
- 6000.0.54f1
- 6000.1.10f1
unityLocalisation:
- true
- false
uniTask:
- true
- false
targetPlatform:
# - StandaloneOSX # Build a macOS standalone (Intel 64-bit).
# - StandaloneWindows64 # Build a Windows 64-bit standalone.
- StandaloneLinux64 # Build a Linux 64-bit standalone.
# - iOS # Build an iOS player.
# - Android # Build an Android player.
# - WebGL # WebGL.
steps:
- name: Create empty Unity project
shell: bash
run: |
mkdir -p ${{ matrix.projectPath }}/Assets
mkdir -p ${{ matrix.projectPath }}/ProjectSettings
mkdir -p ${{ matrix.projectPath }}/Packages
mkdir -p output
# Add the Unity Input System package, and configure the new project to use
# both the Input System and the legacy Input Manager.
- name: Add Input System package
shell: bash
run: |
cat <<EOF > ${{ matrix.projectPath }}/ProjectSettings/ProjectSettings.asset
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!129 &1
PlayerSettings:
activeInputHandler: 2
EOF
cat <<EOF > ${{ matrix.projectPath }}/Packages/manifest.json
{
"dependencies": {
"com.unity.inputsystem": "1.11.2"
}
}
EOF
# Select correct TMP Essentials package
if [[ ${{matrix.unityVersion}} == "2022"* ]]; then
TMP_VERSION="ugui-1.0.0"
else
TMP_VERSION="ugui-2.0.0"
fi
echo "Installing TMP Essentials for $TMP_VERSION"
# Add the correct version of the TMP Essentials package to package manifest
MANIFEST_PATH=${{ matrix.projectPath }}/Packages/manifest.json
jq ".dependencies += {\"dev.yarnspinner.tmp-essentials\": \"https://github.com/desplesda/dev.yarnspinner.tmp-essentials.git#$TMP_VERSION\"}" "$MANIFEST_PATH" > manifest.json
mv manifest.json "$MANIFEST_PATH"
- name: Add Unity Localisation
if: ${{ matrix.unityLocalisation }}
run: |
# Add Unity Localisation package to package manifest
MANIFEST_PATH=${{ matrix.projectPath }}/Packages/manifest.json
jq '.dependencies += {"com.unity.localization": "1.3.2"}' "$MANIFEST_PATH" > manifest.json
mv manifest.json "$MANIFEST_PATH"
- name: Add UniTask Package
if: ${{ matrix.uniTask }}
run: |
# Add UniTask package to package manifest
MANIFEST_PATH=${{ matrix.projectPath }}/Packages/manifest.json
jq '.dependencies += {"com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask"}' "$MANIFEST_PATH" > manifest.json
mv manifest.json "$MANIFEST_PATH"
- name: Check out to Packages/YarnSpinner
uses: actions/checkout@v2
with:
fetch-depth: 0
path: ${{ matrix.projectPath }}/Packages/dev.yarnspinner.unity
- name: Run edit mode tests
run: |
docker run \
--rm \
-v ./${{ matrix.projectPath }}:/project \
-v ./output:/output \
-e TEST_MODE=EditMode \
--hostname YS-Linux-Build \
yarnspinner/unity-${{ matrix.unityVersion }}
- name: Run play mode tests
if: always()
run: |
docker run \
--rm \
-v ./${{ matrix.projectPath }}:/project \
-v ./output:/output \
-e TEST_MODE=PlayMode \
--hostname YS-Linux-Build \
yarnspinner/unity-${{ matrix.unityVersion }}
- name: Generate HTML test report (Play Mode)
uses: rjtngit/nunit-html-action@v1
if: always()
with:
inputXmlPath: output/TestResults-PlayMode.xml
outputHtmlPath: output/TestResults-PlayMode.html
- name: Generate HTML test report (Edit Mode)
uses: rjtngit/nunit-html-action@v1
if: always()
with:
inputXmlPath: output/TestResults-EditMode.xml
outputHtmlPath: output/TestResults-EditMode.html
- name: Upload test results
uses: actions/upload-artifact@v4
if: always()
with:
name: Test results (edit + play, ${{ matrix.unityVersion }} ${{ matrix.targetPlatform }} ${{ matrix.unityLocalisation && 'with-unity-loc' || 'no-unity-loc' }} ${{ matrix.uniTask && 'with-unitask' || 'no-unitask' }})
# path: ${{ steps.testRunner.outputs.artifactsPath }}
path: ./output

View File

@@ -0,0 +1,98 @@
name: Update DLLs 📚
on:
workflow_dispatch:
jobs:
update_dlls:
name: Update Yarn Spinner DLLs
runs-on: ubuntu-latest
permissions:
# We need to be able to:
# 1. create a branch in a repo ('contents'), and
# 2. create a pull request using that branch ('pull-requests')
pull-requests: write
contents: write
steps:
- name: Checkout Yarn Spinner for Unity
uses: actions/checkout@v2
with:
path: YarnSpinner-Unity
- name: Checkout Yarn Spinner
uses: actions/checkout@v2
with:
repository: YarnSpinnerTool/YarnSpinner
path: YarnSpinner
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
6.0.x
9.0.x
- name: Fetch all commits
run: git fetch --unshallow
working-directory: ./YarnSpinner
- name: Install dotnet-assembly-alias
run: dotnet tool install -g Alias
# Update the assembly info for this build of YS, so that the About window is
# appropriate
- name: Execute GitVersion
id: version # step id used as reference for output values
run: ./get-version.sh
working-directory: ./YarnSpinner
- name: Restore dependencies
run: dotnet restore
working-directory: ./YarnSpinner
- name: Build
run: dotnet build --no-restore --configuration Release
working-directory: ./YarnSpinner
# Don't proceed unless we're including a build of Yarn Spinner that passes
# its tests.
- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal
working-directory: ./YarnSpinner
# We need to copy dependency DLLs into the project, but if a Unity project
# contains multiple DLLs with the same name (even from a package), that's an
# error. This causes problems for users who want to use, for example,
# Google.Protobuf (especially if they want to use a different version).
#
# Our solution partly involves renaming the dependency DLLs to have the
# prefix 'Yarn.', and updating all references to these renamed DLLs, using
# dotnet-assembly-alias
# (https://github.com/getsentry/dotnet-assembly-alias/). For more
# information on this fix, see
# https://github.com/YarnSpinnerTool/YarnSpinner-Unity/issues/15#issuecomment-1036162152.
- name: Rename vendored DLLs
run: |
assemblyalias --target-directory "YarnSpinner/YarnSpinner.Compiler/bin/Release/netstandard2.0/" --prefix "Yarn." --assemblies-to-alias "Antlr*;Csv*;Google*;"
assemblyalias --target-directory "YarnSpinner/YarnSpinner.Compiler/bin/Release/netstandard2.0/" --internalize --prefix "Yarn." --assemblies-to-alias "System*;Microsoft.Bcl*;Microsoft.Extensions*"
# Copy all of the dependency DLLs into the YarnSpinner-Unity repo, except
# for Microsoft.CSharp.dll (which is provided by Unity, so including it
# would cause an error.)
- name: Copy DLLs
run: |
cp -v YarnSpinner/YarnSpinner.Compiler/bin/Release/netstandard2.0/*.dll YarnSpinner-Unity/Runtime/DLLs
cp -v YarnSpinner/YarnSpinner.Compiler/bin/Release/netstandard2.0/*.pdb YarnSpinner-Unity/Runtime/DLLs
cp -v YarnSpinner/YarnSpinner.Compiler/bin/Release/netstandard2.0/*.xml YarnSpinner-Unity/Runtime/DLLs
rm -fv YarnSpinner-Unity/Runtime/DLLs/Microsoft.CSharp.dll
# Make the PR against YarnSpinner-Unity that merges this change
- name: Create pull request
uses: peter-evans/create-pull-request@v3
with:
path: ./YarnSpinner-Unity
commit-message: Update Yarn Spinner DLLs to YarnSpinnerTool/YarnSpinner@${{ steps.version.outputs.ShortSha }}
branch: update-dlls-${{ steps.version.outputs.ShortSha }}
title: Update Yarn Spinner DLLs to latest (${{ steps.version.outputs.ShortSha }})
body: |
This is an automated PR made by @${{ github.actor }} that updates the precompiled Yarn Spinner DLLs (and their dependencies) to YarnSpinnerTool/YarnSpinner@${{ steps.version.outputs.ShortSha }} (v${{ steps.version.outputs.SemVer }}).