Method |
The component for adding a virtual method to the parent component.
Virtual method is being entirely created in the editor. Usually, the body of the method is created with Flow Graph Editor. This method isn't much differ from any other from the engine's point of view. It can be called and it can have parameters.
Screenshot display method's body. Method outputs the value of the first parameter to the log (and into Player's console). Below will be discussed how to create such a method.
First, let's create Method object inside scene object.
Set the method name in the appeared window.
In the created method, nested Flow Graph object will appear. One can open its editor clicking the Editor in a context menu.
Flow Graph Editor which method body:
Next, one can add method parameters. The Member Parameter object should be used to do this, which should be added to the method. This object have name, type and other parameters that can be customized. After parameters addition, those will appear in the Method Body node graph.
One can customize method's logic now. Let's add the output of the first parameter to the log (and to the player's console). To do that, drag&drop method Log.Info(string message) from Resources Window. The method can be found at All types\NeoAxis\Log.
Added object should have Flow Control property enabled, so it could be connected with other nodes. Next, one should connect Flow output of the method body with Log.Info() node. Also, connect Parameter1 with parameter Message. Basically, that wraps up this method.
In order to give an example of how to call created method, let's create an event handler. The Enabled Event scene event will be used, that is triggered after scene initialization.
First, select the scene object, at Settings Window go to the Events tab. Next, press desired event's add button. In the appeared menu, chose Add handler to Flow Graph.
After that a new graph with event handler will be created.
Next, place node with our method call in the graph. In order to do that, press Show Members button in the Objects Window, find our method and drop in into the editor's workspace.
Now, one should enable Flow Control property to be able to connect method's node to event handler's node. Customize Parameter1 method's parameter.
That's it. Now you can test if it works by running Player by clicking the Play button in Ribbon.
Name | Description |
---|---|
Body | The body of the method. |