Skip to content

Commit 15c4439

Browse files
author
Unity Technologies
committed
com.unity.visualscripting@1.9.8
## [1.9.8] - 2025-06-11 ### Fixed - Fixed broken links to example codes in API documentation. ### Changed - Adds alt texts to images in documentation to increase accessibility for screen readers.
1 parent 287aad1 commit 15c4439

25 files changed

+241
-94
lines changed

.signature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"timestamp":1747865871,"signature":"mBIRiZRXPBhykSglYyzFwsI6OCI5oqOICtBP5AHRLgfLGxPQlN+S/ZUfgd4tM15jf4oX367vLLWS1rjPQ01rHMTYr93Awangu9qR3OhJS+PUSIEu7ZDNLe15kCuW+Akz4mzXugk6MJU5rMZBXReppJwJHXcGRO/AYG2ujpGPvWxCBtd38EX0cC1j8BjrMPMFEDXZ5KyD8JC4EH1KQuFEpp+wtDpq+2h/MgCzW8yAcu6TlWNStNQk9Fyo2ePABrwYmT3BYa5lkadCEiOHB4axpatLvK4ZDELa6RuL1IZ1jbaz/vIO7yTxq5L5L7wNYFYg+IhBTmG4w5Nf2soOswNm5rSjsv+OD1e7/KhZi4M83HmfuENthrbwZwUBj1iKMof3L9kku52vuzaMjMfhEFjUCau3RhQCFLLo1SHMb94+pDgVDeHlIHjmg/NXhY6afILzSmIEhLBstTh2x6IWHohCzwgl+dZyWPgjT8OtftEn35L1KJ5WOYKIrazMITrpV/dO","publicKey":"LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQm9qQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FZOEFNSUlCaWdLQ0FZRUFzdUhXYUhsZ0I1cVF4ZEJjTlJKSAordHR4SmoxcVY1NTdvMlZaRE1XaXhYRVBkRTBEMVFkT1JIRXNSS1RscmplUXlERU83ZlNQS0ZwZ1A3MU5TTnJCCkFHM2NFSU45aHNQVDhOVmllZmdWem5QTkVMenFkVmdEbFhpb2VpUnV6OERKWFgvblpmU1JWKytwbk9ySTRibG4KS0twelJlNW14OTc1S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atG/","publicKey":"LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUlJQm9qQU5CZ2txaGtpRzl3MEJBUUVGQUFPQ0FZOEFNSUlCaWdLQ0FZRUFzdUhXYUhsZ0I1cVF4ZEJjTlJKSAordHR4SmoxcVY1NTdvMlZaRE1XaXhYRVBkRTBEMVFkT1JIRXNSS1RscmplUXlERU83ZlNQS0ZwZ1A3MU5TTnJCCkFHM2NFSU45aHNQVDhOVmllZmdWem5QTkVMenFkVmdEbFhpb2VpUnV6OERKWFgvblpmU1JWKytwbk9ySTRibG4KS0twelJlNW14OTc1SjhxZ1FvRktKT0NNRlpHdkJMR2MxSzZZaEIzOHJFODZCZzgzbUovWjBEYkVmQjBxZm13cgo2ZDVFUXFsd0E5Y3JZT1YyV1VpWXprSnBLNmJZNzRZNmM1TmpBcEFKeGNiaTFOaDlRVEhUcU44N0ZtMDF0R1ZwCjVNd1pXSWZuYVRUemEvTGZLelR5U0pka0tldEZMVGdkYXpMYlpzUEE2aHBSK0FJRTJhc0tLTi84UUk1N3UzU2cKL2xyMnZKS1IvU2l5eEN1Q20vQWJkYnJMbXk0WjlSdm1jMGdpclA4T0lLQWxBRWZ2TzV5Z2hSKy8vd1RpTFlzUQp1SllDM0V2UE16ZGdKUzdGR2FscnFLZzlPTCsxVzROY05yNWdveVdSUUJ0cktKaWlTZEJVWmVxb0RvSUY5NHpCCndGbzJJT1JFdXFqcU51M3diMWZIM3p1dGdtalFra3IxVjJhd3hmcExLWlROQWdNQkFBRT0KLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg"}

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
All notable changes to this project will be documented in this file.
33
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
44

5+
## [1.9.8] - 2025-06-11
6+
### Fixed
7+
- Fixed broken links to example codes in API documentation.
8+
9+
### Changed
10+
- Adds alt texts to images in documentation to increase accessibility for screen readers.
11+
512
## [1.9.7] - 2025-05-22
613
### Fixed
714
- Fixed a warning "Unable to load Unity.Android.Gradle's referenced assembly NiceIO" when scanning assemblies. [UVSB-2594](https://issuetracker.unity3d.com/product/unity/issues/guid/UVSB-2594)

DocCodeExamples.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
using System;
2+
using Unity.VisualScripting;
3+
using UnityEngine;
4+
5+
class EventBusExamples
6+
{
7+
#region CheatCodeController
8+
public class CheatCodeController : MonoBehaviour
9+
{
10+
public const string CheatCodeActivated = "CheatCodeActivated";
11+
12+
static readonly KeyCode[] famousCheatCode = {
13+
KeyCode.UpArrow,
14+
KeyCode.UpArrow,
15+
KeyCode.DownArrow,
16+
KeyCode.DownArrow,
17+
KeyCode.LeftArrow,
18+
KeyCode.RightArrow,
19+
KeyCode.LeftArrow,
20+
KeyCode.RightArrow,
21+
KeyCode.B,
22+
KeyCode.A
23+
};
24+
25+
int index;
26+
EventHook cheatCodeHook;
27+
Action<EmptyEventArgs> godModeDelegate;
28+
29+
// A GameObject with a ScriptMachine that holds a graph with a
30+
// CheatCodeEnabled Event Node.
31+
public GameObject player;
32+
33+
void Start()
34+
{
35+
// Hold a reference to the EventHook and the Delegate for the
36+
// EventBus.Unregister call in the OnDestroy method.
37+
cheatCodeHook = new EventHook(CheatCodeActivated);
38+
godModeDelegate = _ => EnableGodMode();
39+
40+
EventBus.Register(cheatCodeHook, godModeDelegate);
41+
}
42+
43+
void Update()
44+
{
45+
if (Input.anyKeyDown)
46+
{
47+
if (Input.GetKeyDown(famousCheatCode[index]))
48+
{
49+
index++;
50+
}
51+
else
52+
{
53+
index = 0;
54+
}
55+
56+
if (index >= famousCheatCode.Length)
57+
{
58+
// Triggers the EnableGodMode delegate
59+
EventBus.Trigger(CheatCodeActivated);
60+
61+
// Triggers the CheatCodeEnabled Visual Scripting Node
62+
EventBus.Trigger(new EventHook(
63+
CheatCodeActivated,
64+
player.GetComponent<ScriptMachine>()));
65+
66+
index = 0;
67+
}
68+
}
69+
}
70+
71+
void OnDestroy()
72+
{
73+
EventBus.Unregister(cheatCodeHook, godModeDelegate);
74+
}
75+
76+
void EnableGodMode()
77+
{
78+
Debug.Log("Cheat code has been entered. Enabling god mode.");
79+
}
80+
}
81+
#endregion
82+
83+
#region CheatCodeEnabled
84+
[UnitTitle("On Cheat Code Enabled")]
85+
public sealed class CheatCodeEnabled : MachineEventUnit<EmptyEventArgs>
86+
{
87+
protected override string hookName => CheatCodeController.CheatCodeActivated;
88+
}
89+
#endregion
90+
}

DocCodeExamples/EventBusExamples.cs.meta

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "Unity.VisualScripting.DocCodeExamples",
3+
"rootNamespace": "",
4+
"references": [
5+
"Unity.VisualScripting.Core",
6+
"Unity.VisualScripting.Tests.Editor",
7+
"Unity.VisualScripting.Flow"
8+
],
9+
"includePlatforms": [],
10+
"excludePlatforms": [],
11+
"allowUnsafeCode": false,
12+
"overrideReferences": true,
13+
"precompiledReferences": [],
14+
"autoReferenced": false,
15+
"defineConstraints": [],
16+
"versionDefines": [],
17+
"noEngineReferences": false
18+
}

DocCodeExamples/Unity.VisualScripting.DocCodeExamples.asmdef.meta

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Unity.VisualScripting;
2+
using UnityEngine;
3+
4+
class VariableExamples
5+
{
6+
#region PlayerController
7+
public class PlayerController : MonoBehaviour
8+
{
9+
VariableDeclaration m_Velocity;
10+
void Start()
11+
{
12+
var variables = GetComponent<Variables>();
13+
m_Velocity = variables.declarations.GetDeclaration("velocity");
14+
}
15+
void Update()
16+
{
17+
if (Input.GetKeyDown("space"))
18+
{
19+
var currentVelocity = (float)m_Velocity.value;
20+
m_Velocity.value = currentVelocity * 2f;
21+
}
22+
}
23+
}
24+
#endregion
25+
}

DocCodeExamples/VariableExamples.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Documentation~/vs-control.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,19 @@ Branching nodes split the control flow based on a value.
1212
### If
1313
The common if node uses a boolean condition. Consider them as an "if the condition is true, do something, otherwise, do something else."
1414

15-
![](images/vs-control-if-control-node.png)
15+
![An If node, with True and False branches.](images/vs-control-if-control-node.png)
1616

1717
### Switch
1818

1919
Branch on the value of an enum, a string, or an integer. These nodes are called Switch nodes.
2020

2121
To switch on an enum, decide on the type of the enum. The branch output ports appears.
2222

23-
![](images/vs-control-switch-enum-control-node.png)
23+
![A Switch node branching based on an enum value.](images/vs-control-switch-enum-control-node.png)
2424

25-
To switch on a string or number, create each branch option in the graph inspector.
25+
To switch on a string or number, create each branch option in the Graph Inspector.
2626

27-
![](images/vs-control-switch-string-control-node.png)
27+
![A Switch node branching based on string values.](images/vs-control-switch-string-control-node.png)
2828

2929
The node is updated with each output port.
3030

@@ -40,7 +40,7 @@ Select nodes are the opposite of switch nodes. You can select a single value fro
4040
For example, a Select On Integer node that chooses a color based on a player number.
4141

4242

43-
![](images/vs-control-select-control-node.png)
43+
![A Select node outputs a color based on player number input.](images/vs-control-select-control-node.png)
4444

4545
>[!NOTE]
4646
> In the above example predictive debugging warns of a crash if playerNo is not within 1, 2, 3, or 4, because the Default port is not connected.
@@ -60,7 +60,7 @@ The while loop is the simplest form of loop. It repeats its body while its condi
6060

6161
For example, the following graph generates a new random name until the result isn't contained in the names application variable.
6262

63-
![](images/vs-control-while-loop-node.png)
63+
![The While Loop runs until the Get Variable's list of names and the Set Variable new name don't match.](images/vs-control-while-loop-node.png)
6464

6565
> [!WARNING]
6666
> Do not create an infinite loop. If the condition is always true, the editor hangs. As loop bodies are synchronous, not parallel, there are few uses for while loops in visual scripting.
@@ -76,7 +76,7 @@ For example, the following graph outputs four messages to the console:
7676
* *I love my bird*
7777
* *I love my fish*
7878

79-
![](images/vs-control-for-each-loop-node.png)
79+
![A For Each Loop node iterates the strings from the List node and prints each one to the console.](images/vs-control-for-each-loop-node.png)
8080

8181
To access the key and value from dictionaries in the loop, check the Dictionary box.
8282

@@ -86,7 +86,7 @@ For is a numeric loop and requires three integers: a start index, an end index,
8686

8787
For example, this graph counts to ten by skipping odd numbers because of its step. In other words, its output is 0, 2, 4, 6, then 8.
8888

89-
![](images/vs-control-for-loop-node.png)
89+
![A For Loop node's First value is 0, its Last value is 10, and moves in steps of 2.](images/vs-control-for-loop-node.png)
9090

9191
The For loop can also be very useful when combined with the Get List Item and Count Items nodes.
9292

@@ -99,15 +99,15 @@ Instead of using the For Each node that outputs each item, the graph outputs eac
9999
* *I like birds*
100100
* *I like horses*
101101

102-
![](images/vs-control-for-loop-node-get-count-list-items-node.png)
102+
![A For Loop prints to console from a list by stepping along the list's index.](images/vs-control-for-loop-node-get-count-list-items-node.png)
103103

104104
### Break Loop
105105

106106
A loop can finish early by using the Break Loop node. As soon as this node is entered, the exit port of the loop is called, no matter how many more iterations remain.
107107

108108
For example, even though this for loop is supposed to count to 10, it stops at 5 because of the break. Its output is 0, 1, 2, 3, then 4.
109109

110-
![](images/vs-control-break-loop-node.png)
110+
![A Break Loop node terminating a For Loop node before completion.](images/vs-control-break-loop-node.png)
111111

112112
## Exception Handling
113113

@@ -117,7 +117,7 @@ The Try Catch node handles [Exceptions](https://docs.microsoft.com/en-us/dotnet/
117117

118118
Anything that gets executed in the Try branch is considered "safe": the script continues from the Catch branch instead if it fails. The Exception port captures information about the failure when that happens. A common way of handling this is to log a warning with the exception message.
119119

120-
![](images/vs-control-try-catch-node.png)
120+
![A Try Catch node outputs a log if an exception happens.](images/vs-control-try-catch-node.png)
121121

122122
> [!NOTE]
123123
> By default, this node catches all exceptions. Be specific in your handling by changing the exception type in the dropdown.
@@ -132,7 +132,7 @@ It is good practice to "fail early" by throwing as soon as something unexpected
132132

133133
For example, to ensure damage is positive before applying it:
134134

135-
![](images/vs-control-throw-node.png)
135+
![A Throw node checks a condition before allowing the flow to continue.](images/vs-control-throw-node.png)
136136

137137
If the Custom checkbox is selected, you can pass a custom Exception object that contains more data than a simple message. Most often, this is not required. By default, the thrown exception is of type `System.Exception`.
138138

@@ -164,28 +164,28 @@ Another way of implementing the same logic as the previous example: clicking Spa
164164
> [!NOTE]
165165
> Turn on relations in the toolbar as a means to visualize the flow between the toggle ports.
166166
167-
![](images/vs-control-toggle-flow-value-node.png)
167+
![A Toggle Flow node starts on, and the same input can turn it on or off, depending on its current state.](images/vs-control-toggle-flow-value-node.png)
168168

169169
## Once
170170

171171
The Once node executes different logic the first time it is traversed from any subsequent times.
172172

173-
![](images/vs-control-once-node.png)
173+
![A Once node sends a different string to the console depending on whether this is the first time the node is traversed.](images/vs-control-once-node.png)
174174

175175
It can be reset by entering the Reset port.
176176

177177
## Cache
178178

179-
The Cache node saves the result of an expensive operating and reuses it instead of fetching it again each time you need it.
179+
The Cache node saves the result of an expensive operation and reuses it instead of fetching it again each time you need it.
180180

181181
For example, using this graph, the formula is calculated twice:
182182

183-
![](images/vs-control-cache-node-example.png)
183+
![A graph that calculates the same formula each time an update event runs.](images/vs-control-cache-node-example.png)
184184

185185
By using the Cache node, the result is saved and calculated only once, optimizing performance.
186186

187187

188-
![](images/vs-control-cache-node.png)
188+
![A graph that checks the cache before running the formula. If the cache has a value, the formula isn't calculated.](images/vs-control-cache-node.png)
189189

190190
> [!NOTE]
191191
> It is important to note that caching only lasts within the scope of the current flow. The value of the cache is not shared or available from another event.

0 commit comments

Comments
 (0)