Calling Functions on Variant Activation

When you activate a Variant, call a function instead of changing a property value.


Whenever you bind an Actor to a Variant, the Variant Manager prompts you to choose the properties of that Actor that you want to change when the current Variant is switched on. However, in addition to or instead of changing a bound Actor's property values, you can also specify one or more functions that you want the Variant Manager to invoke on that Actor.

You can set up the Variant Manager to call any function that is already exposed by the Actor you've bound. You can also create your own new Blueprint function from scratch that accepts the bound Actor as an input. The steps on this page show how to do both.


To call a Blueprint function when a Variant is activated:

  1. Double-click your Level Variant Sets Asset in the Content Browser to open it in the Variant Manager UI.

    Open your Level Variant Sets Asset

  2. Select the Variant you want to set up in the left-hand column of the Variant Manager UI.

  3. If you haven't already bound the Actor whose function you want to call to the Variant, drag it from the World Outliner panel into the Actors column of the Variant Manager.

    When the Variant Manager prompts you to select which properties you want to capture, you can leave all the properties unchecked. Click Select to continue.

  4. Right-click your Actor in the list of bound Actors on the Variant, and select Add function caller from the contextual menu.

  5. Find the new Function caller item at the bottom of the Properties column, and use the dropdown list in the Values column to choose the function you want to call.

    Choose Create New Function to create a totally new Blueprint function, or choose an existing function from the Create Quick Binding list if your Actor is already set up with the function you want to call.

  6. The Variant Manager opens a special Blueprint class for you to edit, called the LevelVariantSetDirector. This Blueprint is owned by the Level Variant Sets Asset. Its role to store all logic that you need to run in respose to your Variants being activated.

    The Variant Manager automatically creates a new function for you in the LevelVariantSetDirector Blueprint. Whenever your Variant is activated, the Variant Manager automatically calls this function, and passes it a reference to the bound Actor that you set up with the Function Caller in the previous step. If you need to further customize the Blueprint logic that gets triggered when the Variant is activated, you can do it in this graph.

    If you chose to create a new function in the previous step, you get a new empty function with a default name. You can fill out this function with any Blueprint logic you need to carry out.

    Result of creating a new function

    If you chose to create a quick binding to an existing function exposed by the Actor, the Variant Manager automatically adds a call to that function and hooks it up to the new function it creates in the LevelVariantSetDirector Blueprint. If the function being called on the Actor requires any other input values, such as the New Actor Enable Collision option in the image below, you can set them up in this graph.

    Result of creating a quick binding

    By default, the Variant Manager only calls your function when the Variant is activated at runtime. If you want your function to also run when the Variant is switched on in the editor, select your function node in the LevelVariantSetDirector Blueprint and enable the Call in Editor setting in the Details panel.

  7. When you are done setting up your new function or quick binding in the LevelVariantSetDirector Blueprint, Compile and Save the Blueprint. You can then close the Blueprint Editor and the Variant Manager window.

End Result

Whenever you switch on the Variant that you set up with a function caller at runtime, the Variant Manager automatically invokes the function you defined in the LevelVariantSetDirector Blueprint.

If you've enabled the Call in Editor option for the function in the LevelVariantSetDirector Blueprint, the Variant Manager will also automatically invoke your function when you switch on that Variant in the Unreal Editor.

You can add multiple function callers to a single bound Actor if you need to call multiple functions on that Actor when a Variant is activated.

Select Skin

새로운 언리얼 엔진 4 문서 사이트에 오신 것을 환영합니다!

문서 사이트에 대한 의견을 모을 수 있는 피드백 시스템을 포함해서 여러가지 새로운 기능을 준비하고 있습니다. 아래 Documentation Feedback 포럼(영문) 또는 언리얼 엔진 네이버 공식 카페(한글) 중 편하신 곳에 의견이나 문제점을 알려 주세요.

새 시스템이 준비되면 알려 드리겠습니다.

네이버 카페
공식 포럼