Click or drag to resize

Method

Method

The component for adding a virtual method to the parent component.

Contents
Overview

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.

Screenshot999999612.png
How to create

First, let's create Method object inside scene object.

Screenshot999999604.png

Set the method name in the appeared window.

Screenshot999999605.png

In the created method, nested Flow Graph object will appear. One can open its editor clicking the Editor in a context menu.

Screenshot999999606.png

Flow Graph Editor which method body:

Screenshot999999607.png

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.

Screenshot999999608 2.png

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.

Screenshot999999609 2.png

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.

Screenshot999999612 2.png
Method call example

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.

Screenshot999999613 2.png

After that a new graph with event handler will be created.

Screenshot999999614.png

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.

Screenshot999999621 2.png

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.

Screenshot999999617 2.png

That's it. Now you can test if it works by running Player by clicking the Play button in Ribbon.

Screenshot999999618.png
Properties
Name Description
Body The body of the method.
See also
PropertyMember Parameter