Jump to content
Aveyond Studios Community
Sign in to follow this  
Amaranth

Call Method in Script Component

Recommended Posts

f1BnKSA.png

Description

Use a method in a script.

A few important notes:

  • If the script is not attached to the game object, you need to do this first, using the Attach Script Component action. If the script is not attached, nothing will happen.
  • The method must be public. 
  • Parameters must not use the ref or out keywords.
  • If the method has a parameter type that is not supported by HeroKit, the action will be skipped. If you absolutely need this parameter type, you can modify HeroKit to include it (you will need to code c#).
  • This action uses Reflection, which is not performant. If you need to use the method in an event which loops, create a custom action for it.

Fields

Use the method on a different object - If you want to use this action on another hero object, mark this box and select the hero object (hero object field A).

The script on the hero object - Put the script you want to work with in this field (unity object field A). Information about the script populates the next fields.

The method to call in the script - Select the method that you want to call in the script. Only public methods are shown.

Parameters to pass into this method - (If the method has parameters, they are listed here) A list of parameters that you want to pass into the method. You can only work with parameters that can be linked to variables in a hero object or hero property.

There are no parameters for this method - This appears if the method has no parameters to pass into it.

Return value to save on the hero object - (If the method has a return value, it is listed here) The value that is returned by the method. You can only work with parameters that can be linked to variables in a hero object or hero property.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×