Knowledge Base - Adding a Visual Script

To use iCanScript, you first need to install a visual scripts on one of your game objects. To illustrate this process, we will add a visual script to a sphere that will later be used as a trigger zone.

To do so, you must:

  1. Select a game object to contain the visual script;
  2. Create a visual script using the menu item: iCanScript->Create Visual Script.
Figure 1. Create Visual Script menu item.
Figure 1. Create Visual Script menu item.

Et voilĂ , you have a visual script !!! It does not do anything yet but it is ready to listen and react to Unity messages. We will look at defining and handling Unity messages in the next section. For now, let’s examine the changes brought when creating the visual script.

When iCanScript creates a visual script, it attaches two (2) Unity script components on the game object. These components are:

  1. iCS_VisualScript (persistent storage)
  2. iCS_Behaviour (runtime compiler & execution services)
Figure 2. iCanScript visual script components.
Figure 2. iCanScript visual script components.

The iCS_VisualScript contains the visual script persistant data including the definitions of nodes, ports, bindings as well as their layout information. It is populated and modified by the iCanScript editors.

The iCS_Behaviour is dynamically created from the visual script data and includes the source code for the message handlers of the visual script. It uses the execution services of the iCanScript engine library (i.e. iCanScriptEngine.dll) to manage the execution flow and resolve data contention (also known as deadlocks).

Note: You must delete the iCS_VisualScript component to remove the visual script from the game object. The iCS_Behaviour component will be re-created if you delete it while the iCS_VisualScript is installed.


Created : 2015-03-16 20:21:16, Last Modified : 2015-03-16 20:21:16

User Comments

Add a Comment

Search Articles

Member Login