docs.unity.cn
Search Results for

    Show / Hide Table of Contents

    Method RequestAction

    RequestAction()

    Requests an action for this agent.

    Declaration
    public void RequestAction()
    Remarks

    Call RequestAction() to repeat the previous action returned by the agent's most recent decision. A new decision is not requested. When you call this function, the Agent instance invokes OnActionReceived(ActionBuffers) with the existing action vector.

    You can use RequestAction() in situations where an agent must take an action every update, but doesn't need to make a decision as often. For example, an agent that moves through its environment might need to apply an action to keep moving, but only needs to make a decision to change course or speed occasionally.

    You can add a DecisionRequester component to the agent's GameObject to drive the agent's decision making and action frequency. When you use this component, do not call RequestAction() separately.

    Note that RequestDecision() calls RequestAction(); you do not need to call both functions at the same time.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023