Skip to content

Commit

Permalink
Allow . characters in Yarn action names
Browse files Browse the repository at this point in the history
  • Loading branch information
desplesda committed Dec 4, 2024
1 parent c9c42ed commit e60698d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- `UnityLocalisedLineProvider` no longer throws an exception if an asset table is provided but does not contain an asset for a line.
- `DialogueRunner.CommandDispatcher` is now set up on first access, rather than in `Awake`.
- This allows other objects to work with the command dispatcher (for example, registering new methods) in their `Awake` methods, even if their `Awake` methods run before `DialogueRunner`'s.
- `YarnCommand` and `YarnFunction` commands now allow including `.` characters in their names.

### Changed

Expand Down
7 changes: 3 additions & 4 deletions Editor/Analysis/Action.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,9 @@ public Action(string name, ActionType type, IMethodSymbol methodSymbol)
diagnostics.Add(Diagnostic.Create(Diagnostics.YS1001ActionMethodsMustBePublic, methodDeclaration.Identifier.GetLocation(), methodDeclaration.Identifier, MethodSymbol.DeclaredAccessibility));
}

// This is not a full validation of the naming rules of commands,
// but is good enough to catch the most common situations:
// whitespace and periods.
if (Name.Contains(".") || Name.Any(x => Char.IsWhiteSpace(x)))
// Commands are parsed as whitespace, so spaces in the command name
// would render the command un-callable.
if (Name.Any(x => Char.IsWhiteSpace(x)))
{
diagnostics.Add(Diagnostic.Create(Diagnostics.YS1002ActionMethodsMustHaveAValidName, methodDeclaration.Identifier.GetLocation(), this.Name));
}
Expand Down
Binary file modified SourceGenerator/YarnSpinner.Unity.SourceCodeGenerator.dll
Binary file not shown.

0 comments on commit e60698d

Please sign in to comment.