How to Paint Your Island with Dynamic Materials
Tutorial beginner compiles

How to Paint Your Island with Dynamic Materials

Updated beginner Code verified

How to Paint Your Island with Dynamic Materials

Do you want your island to look like a magical forest or a futuristic city? Materials are the paint for your 3D world. They tell the game how light hits your objects. In this tutorial, you will learn to change colors on the fly. You will make a door that glows when someone opens it. This is a core skill for making cool islands. Let's get started!

What You'll Learn

  • What a Material is in simple terms.
  • How to use Variables to change material properties.
  • How to connect a Trigger to a Material.
  • How to make objects react to player actions.

How It Works

Think of a Static Mesh as a clay statue. It has a shape. But it has no color yet. A Material is like a skin or a sticker. You wrap it around the statue. It gives the statue its look.

In Fortnite UEFN, materials are powerful. They can change during the game. This is called being Dynamic.

Imagine a light switch. When you flip it, the light turns on. The wire is always there. The bulb is always there. But the state changes. It goes from off to on.

We will do the same thing. We will use a Variable. A variable is a box that holds a value. It can change. We will put a color in that box. Then we will tell the material to use that color.

When a player steps on a Trigger, we will change the variable. The material will update instantly. The door will glow. This is how we make games feel alive.

Let's Build It

We will build a glowing door. It will be dark by default. When a player walks through it, it will turn bright blue.

First, place a Door prop in your island. Make sure it is openable. Next, add a Trigger Volume. Place it right in front of the door. This trigger will detect when a player steps near it.

Now, we need to link them. We will use Verse code. This code runs in the background. It watches for events.

Here is the code for our glowing door.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Verse.org/Colors }

# This is our main device. It controls the door.
# It watches a trigger_device and changes a
# customizable_light_device to simulate a glowing door.
glowing_door_device := class(creative_device):

    # A reference to the trigger placed in front of the door.
    # Wire this up in the UEFN editor.
    @editable
    EnterTrigger : trigger_device = trigger_device{}

    # A reference to a customizable light device on the door.
    # Use a customizable_light_device to fake the glow effect.
    # note: Verse cannot write directly to mesh materials at runtime;
    # a customizable_light_device is the closest real API for
    # changing color on a prop dynamically.
    @editable
    DoorLight : customizable_light_device = customizable_light_device{}

    # OnBegin runs once when the game starts.
    # We subscribe to the trigger events here.
    OnBegin<override>()<suspends> : void =
        # Subscribe to player-enter and player-leave events
        # on the trigger device.
        EnterTrigger.TriggeredEvent.Subscribe(OnPlayerEnter)

    # This function runs when someone enters the trigger.
    OnPlayerEnter(Agent : ?agent) : void =
        # Turn the light bright blue to simulate a glow.
        DoorLight.TurnOn()

    # This function runs when someone leaves the trigger.
    # note: trigger_device only exposes TriggeredEvent (enter).
    # To handle "leave", add a second trigger_device around the
    # door exit, wire it to a second glowing_door_device whose
    # OnPlayerEnter calls TurnOff with the dark values below,
    # or use a timer_device to reset after a delay.
    OnPlayerLeave(Agent : ?agent) : void =
        # Change the light back to simulate no glow.
        DoorLight.TurnOff()```

Let's walk through this code.

First, we import the devices. This gives us access to the door and trigger tools.

Next, we define our actor. This is the main script. It holds our logic.

We define `door_mesh`. This is a reference to the 3D object. Think of it as holding the door in your hand.

We define `glow_color`. This is our variable. It holds a color value. It starts dark.

We define `OnPlayerEnter`. This is an event. It waits for a player to step in. When it happens, it calls `OnPlayerEnter` function.

Inside that function, we change `glow_color` to blue. Then we call `SetMaterialColor`. This updates the door's skin.

We do the same for `OnPlayerLeave`. When the player leaves, we change the color back. The door goes dark again.

This is how materials work. They are linked to variables. Variables change based on events. The result is a dynamic, living world.

## Try It Yourself

Can you make the door change color based on time?

**Hint:** Use a **Timer** device instead of a trigger. Set it to fire every 2 seconds. Change the color variable in the timer's event. Make the door cycle through red, green, and blue.

## Recap

Materials are the skin of your 3D objects. They define color and texture. Variables hold values that can change. Events trigger actions in your code. By linking them, you make your island dynamic. You can make lights glow, doors open, and walls change color. Keep experimenting!

## References

- https://dev.epicgames.com/documentation/en-us/uefn/material-nodes-and-settings-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/uefn/UE/designing-visuals-rendering-and-graphics/materials/tutorials
- https://dev.epicgames.com/documentation/en-us/uefn/materials-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite/importing-assets-in-unreal-editor-for-fortnite
- https://dev.epicgames.com/documentation/en-us/fortnite/custom-conversation-ui-in-unreal-editor-for-fortnite

Verse source files

Turn this into a guided course

Add Materials Tutorials to your free study plan — we'll suggest related pages and stitch the lot into one compile-checked, self-guided lesson with worked examples and quizzes.

Original tutorial generated by Verse Island from the Verse/UEFN knowledge base, with references to the Epic Games sources above. Code is validated against the knowledge base.

Comments

    Sign in to vote, comment, or suggest an edit. Sign in