Hi RainyRizzle!
Long time no see. I'm happy to see RainyRizzle developers keep going!
I've been developing games on Unreal Engine for about a year. Now I'm back to Unity to develop 2D games. (Unreal Engine does not have AnyPortrait you know :))
However, as you know, visual scripting (aka blueprint) is commonly used in Unreal Engine. And I got really used to it and I like it.
I know we can do this in Unity as well, called Visual Scripting. But I don't know if it supports custom plugin (AnyPortrait) by default. If it doesn't, is it okay for me to wait for an update from you or can you show me a tutorial if it can be done quickly?
Thank you in advance!
Hi!
Welcome back to Unity!
Because Visual Scripting can use most of the C# API, you can use AnyPortrait's features using Visual Scripting.
There are two ways to use C# Script functions, using Visual Scripting.
One is to use the script function directly, and the other is to write a "Custom Node".
We will tell you how to use the former, i.e. script functions directly.
Prior to the explanation, if you want to implement a "Custom Node" that is not described here, you can see the detailed explanation in the following link.
https://docs.unity3d.com/Packages/com.unity.visualscripting@1.7/manual/vs-create-custom-node.html
Additionally, we have created and deployed Custom Actions for another similar asset, PlayMaker.
It might be helpful to look at this manual as well.
https://rainyrizzle.github.io/en/AdvancedManual/AD_PlayMaker.html
Let's make a simple "Demo where the <Smile> animation and the <Idle> animation of the target AnyPortrait character are played in sequence when the Space key is pressed."
(1) This is a sample scene where the AnyPortrait demo characters are placed.
(2) Add a new GameObject to which Visual Script will be applied.
(3) Add "Script Machine" component.
Next, click the "New" button to add the Script Graph Asset.
(1) Script Graph Asset is assigned.
(2) Set the name of the Script Graph and press the "Edit Graph" button.
(1) Create an "Object Variable" in Blackboard > Object.
(2) Set the name as "portrait" and the type as "apPortrait" (notationally, it is shown as Ap Portrait).
Drag and drop the added Variable item to bring it to the Graph.
(1) Use the "If" node and the "Input:GetKeyDown" node to create a conditional statement "If the Space key is pressed".
Create a node from the "portrait" Variable.
At this time, if the keyword starts with "apPortrait:", the functions provided by AnyPortrait are displayed.
Since we need to play the animation, we choose the "Play" function.
(1) The "apPortrait:Play" node is added.
Make the "portrait" Variable the target, and connect it to the "True" of the If node.
(2) I assigned the name of the animation as "Smile".
Next, create the "CrossFadeQueued" node of "apPortrait" in the same way.
I made the "apPortrait:Play" node followed by the "apPortrait:CrossFadeQueued" node to run, and set the name of the animation to "Idle".
When the graph is completed as above, save and return to Unity Scene.
If you select Script Machine, you will see "portrait" added to Variables.
(1) Assign the AnyPortrait character in the scene to the "Value" item.
Run the game and press the "Space key" to play the Smile animation and the Idle animation in sequence.
You can check out the script functions we provide on the following page.
https://rainyrizzle.github.io/en/Script.html
If you have more questions about Visual Scripting, a variety of Unity tutorials will help you.
Thank you!