docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Create tool actions

    A class is associated with each tool action. You can instantiate this class to run a process on a data stream.

    Tool actions are available from the Rule Engine and the Toolbox.

    The PixyzFunction class inherits from the class ActionInOut<IList<GameOject>,IList<GameOject>>. Use the PixyzFunction class to automatically convert input data into Pixyz and then back into Unity. This class supports asynchronous execution of Pixyz functions.

    Create a tool action

    The class that is associated with a new tool action must inherit from one of these classes:

    Class Description
    ActionIn<Input> Use this class to create an end point, that is, to prompt input without returning results.
    ActionInOut<Input, Output> Use this class to create an action to prompt input, and then return results.
    This type of action is the most commonly used.
    ActionOut<Output> Use this class to create a start point, that is, to return results without input.

    To create a script template, use one of these alternatives:

    • Select Pixyz > Toolbox > Create new Toolbox Action.
    • Select Pixyz > RuleEngine > Create new RuleEngine Action.

    You must place the scripts in a folder that is named Editor.

    Add parameters

    To add parameters, add fields and mark them with the UserParameter attribute.

    A parameter can be of these types:

    • class
    • struct
    • list
    • enum
    • A base type, such as string or int

    For each parameter, the Toolbox or Rule Engine displays the proper input.

    Add helper methods

    Helper methods are parameterless methods that you can run through the Rule Engine.

    To create a helper method, mark your method with the HelperMethod attribute.

    To use helper methods, select the More button (…) in the Action section of the Rule Engine.

    Display messages

    You can display error messages, warning messages, and information messages.

    You can override methods, such as the getErrors() method, for various purposes. For example, you might want to implement a parameter checking method to display an error message when a user enters an incorrect value.

    preProcess, postProcess, and process methods

    The preProcess and postProcess methods are called on the main thread of Unity. You can use them safely when making calls to the Unity API. You can override the preProcess method, but you must still call the base method from the overridden method. The reason is that the PixyzFunction class handles conversion.

    The process method is available only in the PixyzFunction class. You can call this method asynchronously, in which case the unity API doesn't run. When using the PixyzFunction class, you can override only the process method but not the run or runAsync method.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)