Set and Get an Actor Reference

Using Actor Reference to move different Actors around in a level.

Choose your operating system:

Windows

macOS

Linux

On this page

In Unreal Engine 5, you can create, delete, and manage Assets directly from the Content Browser. This page describes common Asset workflows, and explains what Asset references are and how to handle moving or deleting your Assets in the editor. Further, you will explore how to export some types of Assets from Unreal Engine into a format that other applications can import.

Creating Assets

To create a new Asset, right-click inside a blank area of the Content Browser. Then, from the context menu that appears, choose the Asset you want to create. This creates a blank Asset of the type you specified. For some Assets, like Blueprints, you can select additional options, like the Blueprint's parent class.

Unlike importing Assets, which brings something you made in an external application into Unreal Engine, this method creates a blank Asset which you can populate with content.

Asset References

If an Asset makes use of another Asset in some way, we say that the Assets reference (or have a reference to) each other. For example, if a Cube Actor uses a Color Material, the Actor references that Material. This is why it is important to make sure that references are updated whenever you move or rename an Asset, and that you remove any references to an Asset before you delete it.

Viewing Asset References

To view an Asset's references, right-click the Asset in the Content Browser. Then, from the context menu that appears, select Reference Viewer. A new window will open that displays a visual representation of the Asset's references.

For more information about the Reference Viewer, refer to the Finding Asset References page.

Copying Asset References

To copy one or more Assets' references to the clipboard, select the Asset or Assets in the Content Browser. Then, right-click your selection and, from the context menu that appears, select Copy Reference.

References contain the Asset type and the path to the .uasset file. They will look similar to the examples below:

    Material'/Game/StarterContent/Materials/M_Metal_Brushed_Nickel.M_Metal_Brushed_Nickel'
    Material'/Game/StarterContent/Materials/M_Metal_Burnished_Steel.M_Metal_Burnished_Steel'
    Material'/Game/StarterContent/Materials/M_Metal_Chrome.M_Metal_Chrome'

This is useful if you need to paste the Asset's reference in a text field, or if you need to generate an external list of Assets.

Replace References Tool

The Replace References Tool provides a way to combine multiple Assets into a single one.

To learn more about this tool, refer to the Replace References tool page.

Managing Assets

To perform common Asset actions, right-click the Asset and select the desired action from the context menu that appears. These actions include:

Action

Description

Edit

Opens the selected Asset in its Editor. For example, performing this action on a Blueprint opens it in the Blueprint Editor.

Rename

Makes the Asset's name editable. To rename the Asset, type a new name and press Enter. After you rename the Asset, Unreal Engine will update all references to the Asset to its new name.

Duplicate

Creates a copy of the selected Asset at the current location. To relocate the copy, drag it to another folder.

Save

Saves the selected Asset.

Show in Folder View

Highlights the Asset's parent folder in the folder tree. Useful for finding the actual location of Assets that are part of a collection.

Show in Explorer (Windows) / Show in Finder (Mac)

Opens an instance of Windows Explorer or Finder at the Asset's location on disk. This is the location of the .uasset file.

Never move, copy, or delete Assets directly on disk, as this might break functionality in your project and lead to data corruption or data loss. Always manage .uasset files through Unreal Editor.

If you need to move an Asset from one project to another, refer to the Migrating Assets page to learn how to do this.

Moving and Copying Assets

You can move or copy Assets and folders in your project through the Content Browser.

The steps to moving or copying an Asset are:

  1. Click the Asset you want to move, then drag it to another folder in the Content Browser or folder tree. As you drag the Asset, a popup window will follow your mouse cursor, indicating which Asset you are trying to move.

    Moving an Asset with drag-and-drop

  2. When you release the mouse button, a menu will appear.

    Move Asset menu

    The menu confirms the folder name and contains a list of three options:

Option

Description

Move Here

Moves the Asset to the new location.

Copy Here

Creates a copy of the Asset at the new location, and leaves the original Asset at its current location.

Advanced Copy Here

Creates a copy of the Asset at the new location, and attempts to automatically resolve all of that Asset's references and dependencies. This option includes an additional save dialog where you need to confirm that you want to save the Asset you copied.

Deleting Assets

To delete an Asset, you can either:

  • Right-click it in the Content Browser. Then, from the context menu that appears, select Delete.

  • Select the Asset in the Content Browser, World Outliner, or Level Viewport, then press Delete on your keyboard.

This action will bring up a confirmation window. If your Asset isn't being referenced anywhere (that is, it's not being used anywhere in your Unreal project), click the Delete button to confirm:

Deletion confirmation window

If your Asset is being referenced somewhere, the confirmation window will notify you of this and ask you what you want to do. There are two types of referencing that can happen:

  • If the Asset is referenced by other Assets, it means that another Asset in your project is using this one. For example, if you are trying to delete a Material, and a Static Mesh uses that Material, you will see this warning.

  • If the Asset is referenced in memory, it could be open in a separate editor window, or it might have been used recently and is still cached in memory.

    If you are seeing zero Asset References, but at least one Memory Reference, close all other editor windows and try again. If that doesn't work, save your work and restart Unreal Engine.

In this situation, you have two options:

Deleting an Asset that still has references

  • If you select Replace References, you can choose another Asset to replace this one wherever it is referenced in your project. For example, if a Static Mesh uses a Material, and you want to delete that Material, you can choose a different Material that the Static Mesh will use after the deletion.

  • If you select Force Delete, the Asset will be deleted without any additional corrections being performed.

    This can cause data corruption and data loss. At a minimum, Assets that reference the deleted one will no longer work correctly, but this can break your entire project.

Exporting Assets

Assets in your project are stored on disk as .uasset files, which is a file format specific to Unreal Engine. Exporting an Asset saves it to disk in a format that can then be read by other applications.

To export an Asset from your project, right-click it in the Content Browser. Then, from the context menu that appears, select Asset Actions > Export. This will open a window where you can name your exported Asset and select the location where to save it.

The file type available for export will change depending on the type of Asset you selected. For example, for a Static Mesh Asset, you will see the options to export it as an FBX, OBJ, COPY, or T3D file.

Not all Assets can be exported.

Follow the steps below for an example of Setting and Getting reference to an Actor.

For this example, we are using a new Blueprint Third Person Template with Starter Content enabled.

  1. From the Place Actors panel in the Basic tab, drag a Box Trigger into your level.

    1AddTriggerBox.png

    We are going to use this to trigger movement in another Actor in the level.

  2. In the Details panel for the Box Trigger, select the Convert to Class Blueprint option.

    2ReplaceWithBlueprint.png

    We are going to create a Blueprint out of this Actor and assign a variable within it which will store the reference Actor.

  3. Give the Blueprint a name then select Create Blueprint (the Blueprint Editor will open).

  4. In the Blueprint Editor, under My Blueprint, click the Add Variable button.

    3AddVariable.png

  5. Click on the variable, then in the Details panel, click the Variable Type button and select Actor under Object Reference.

    4VariableType.png

    Here we are specifying that the reference is of the Actor type and is an Object in our level.

  6. Name the variable TargetActor and click the Editable checkbox.

    5NameVariable.png

    This indicates that the variable is set to Public which allows it to be accessed and set outside of this Blueprint via the Details panel in the Main Editor window. This is useful in situations where you want to modify the variable without having to go into the Blueprint to modify it.

  7. You can also enter in text to appear as the Tooltip for what the variable does or is intended for.

    7ToolTip.png

    Here we have entered in the text "The Actor to Target".

  8. Click the Compile button in the upper left portion of the Blueprint Editor window.

    20Compile.png

    It will change to a green check mark after compiling.

    21Complete.png

  9. Minimize the Blueprint and return to the Main Editor window then select the Box Trigger Blueprint in your level.

  10. In the Details panel for the window, you should see under Default the Target Actor variable and tooltip.

    8DetailsPanel.png

  11. From the Content Browser, under Content/StarterContent/Shapes add three Shape_Cubes to the level.

    9AddingAnActor.png

    If you are using your own project, you can add any Actor, Static Mesh, or Blueprint to the level instead.

  12. Whatever you add to the level, in the Details panel for each Actor, set their mobility to Moveable.

    22Moveable.png

    This will allow us to move them via Blueprint script.

  13. Click on the Box Trigger Blueprint in the level.

  14. In the Details panel, click the None box under Target Actor and search for Shape (or the name of the Actor(s) added).

    10DropDownSelection.png

    When clicking None all Actors currently in the level are displayed, however we are going to target one of the cubes we added.

  15. Click the eye dropper icon next to the magnifying glass icon.

    11PickActor.png

    This will allow you to select an Actor from your level as the Target Actor by clicking on it in the viewport.

  16. Move the eye dropper icon over one of the cubes (or other asset you have added) and click it to make it the Target Actor.

    11ActorSelected.png

  17. When you select an Actor, the Target Actor variable will update with the selected Actor in the Details panel.

    13ActorSelected.png

    Here we have Set reference to an Actor which will be our Target Actor.

  18. Open the Box Trigger Blueprint, then in the MyBlueprint window, click the eye icon and enable Show Inherited Variables.

    showVariables.png

    This will allow us to add events on the Components that were inherited when we first converted the Trigger Box to a Class Blueprint.

  19. Under Trigger Base, Right-click on CollisionComponent and choose Add Event then Add OnComponentBeginOverlap.

    14AddOverlap.png

    This will create a new Event node on the graph.

  20. Hold Control and drag the TargetActor variable into the graph.

    15GetActorReference.png

    This creates a Get node which will get whatever is assigned to the variable which we have set to an Actor in our level.

  21. Drag off the TargetActor node, search for and add an Add Actor Local Offset node.

    16AddOffSet.png

    This will allow us to add to the current target's transform (allowing us to move it from its current position).

  22. Connect the nodes as shown below and set the Z value on the Add Actor Local Offset node to 500.0.

    17AddZValue.png

    This will get the target's current location and move it up by 500 along the Z axis whenever the trigger box is overlapped.

  23. In the Components window, click TriggerBox_Blueprint so it is selected.

    selectTriggerBox.png

    If you do not see the Components window, you can enable it from the Window menu option.

    enableComponentWindow.png

  24. In the Details panel for the Trigger Box, under Rendering, un-check the Actor Hidden In Game option.

    19ActorHiddenInGame.png

    This will make the trigger box visible in-game so that you can see where it is to enter it with your player.

  25. Click Compile and Save, then close the Blueprint.

  26. From the Main Editor Window, click the Play icon to play in the editor.

When you enter the Trigger Box, your selected Actor should move up by 500 units. Each time you enter the Trigger Box, the box will move up by another 500 units. By establishing a reference, the variable knows which Actor to affect in the Trigger Box script. Try affecting a different Actor in the level using this script.

  1. From the Main Editor window, inside the Level Viewport click the Box Trigger Blueprint.

  2. In the Details panel for the Box Trigger, click the eye dropper icon next to Target Actor.

    11PickActor.png

  3. In the level viewport, click a different Actor than the one you used before.

  4. Play in the editor again.

This time the new Actor selected should move up along the Z axis by 500 units each time you enter the Trigger Box. By using the Target Actor variable in our Box Trigger script, we are not locked into a specific Actor associated with the script and can modify it and change the Actor it affects without having to modify the Blueprint itself.

While this example illustrates how to move different objects around, instead of moving an object you could use this method to open doors when the player presses a button, turn on/off different lights, spawn items for the player to pick up or destroy or any number of other possibilities.

This is also one of multiple ways you can get reference to an Actor, for example if you wanted to get Reference to the Player Character which cannot be explicitly set via the Main Editor window, you would take a different approach (see the Related Links section below).

This page was written for a previous version of Unreal Engine and has not been updated for the current Unreal Engine 5.0 release.