Create a simple dialog system using the visual scripting system integrated into the package manager of Unity 2021.1+. We will use VS for the state machine aspect of the system and code for the process of displaying text and buttons on the screen while making these methodologies work together in a straightforward and extensible way. Includes a discussion at the end regarding the relative advantages of VS and code and when to use each.
Timestamps for reference:
1:00 - Open project and getting the VS package
2:30 - Setup UI and create empty DisplayDialog script
4:45 - Create a State Machine
6:35 - Troubleshooting - Regenerating Units
8:53 - Calling C# methods with SendMessage
11:46 - Packing dialog node data into ScriptableObjects and activating the buttons dynamically.
16:30 - Passing a ScriptableObject into a graph state
18:57 - Calling the SetNode method directly
20:48 - Adding a new state & transition
22:05 - Triggering a state transition with a UnityEvent
23:25 - Invoking the UnityEvent-based transition from DisplayDialog (including extending UnityEvent to send a dynamic string)
27:23 - Adding more states to the graph
32:00 - Discussion time! When to use Visual Scripting and when to use code. Summary: VS is better for expressing relationships between concepts (e.g. state machines) and code is better for describing processes. Also, VS is one way to expose logic to designers--which is useful sometimes.
Ещё видео!