Knowledge Base - Tagging your Source Code

iCanScript includes several .NET attributes to control which part of your source code is to be included in the iCanScript library. These attributes enables fine control over which fields, properties and functions become visible to the iCanScript user.

iCanScript scans the .NET assemblies to populate its library with public classes tagged with the iCS_Class attribute. The assembly scan is performed after every recompile of the Unity scripts.

The following table depicts the mapping between C# source code and iCanScript objects:

Table 1. Mapping between C# source code and iCanScript objects.
Source Code iCanScript Objects
class Class / Type Node
field Port
property Port
constructor
Variable Builder Node
instance function Function Node with a “this” input port
class function Function Node without a “this” input port

Note: All source code elements tagged with an iCanScript attribute MUST HAVE a public programmatic scope.

iCanScript .NET Attribute Reference

The following two tables enumerates the supported iCanScript attributes and their associated parameters:

Table 2. iCanScript .NET Attributes
Attribute Name Targets Parameters
iCS_Class class or structure Company
CompanyIcon
Library
Icon
Tooltip
BaseVisibility
iCS_Function constructor,
function,
property get,
property set
Name
Return
Icon
Tooltip
iCS_InPort field
iCS_OutPort field
iCS_InOutPort field
Table 3. iCanScript .NET Attribute Parameters.
Parameter Name Type Description
BaseVisibility bool if true: adds the base classes public variables and functions.
Company string The name shown at the first level of the library tree.
CompanyIcon string Path to the iconic representation of the company.
Icon string Path to the iconic representation of the node.
Name string Function name substitute.
Library string The name shown at the second level of the library tree.
Return string Port name for the function return value.
Tooltip string Brief description of the component.

iCS_Class Attribute

iCanScript adds a type node to its library for each class and structure marked with the iCS_Class attribute.

Note that iCanScript will only add public classes and structures.

Example:

Figure 1. iCS_Class attribute example.
Figure 1. iCS_Class attribute example.

iCS_Function Attribute

You can publish to the iCanScript library your C# properties, constructors, instance function and class function using the iCS_Function attribute.

See Tagging your Source Code for details on the C# source code to iCanScript object mapping.

Note: The iCS_Function attribute can only be applied to public members of the C# class.

Example:

Figure 2. iCS_Function attribute example.
Figure 2. iCS_Function attribute example.

iCS_InPort, iCS_OutPort, and iCS_InOutPort Attributes

You can publish to the iCanScript library your C# fields using the iCS_InPort, iCS_OutPort, and iCS_InOutPort attributes.

Note: The iCS_xxPort attributes can only be applied to public fields of C# classes.

Example:

Figure 3. iCS_xxPort attribute example.
Figure 3. iCS_xxPort attribute example.

Details

Created : 2015-03-16 20:11:47, Last Modified : 2015-03-16 20:11:47

User Comments

Add a Comment

Search Articles

Member Login