# Properly Troubleshooting "Accessed None" Error with Dynamic Material when a delay fix the issue

**URL:** <https://forums.unrealengine.com/t/properly-troubleshooting-accessed-none-error-with-dynamic-material-when-a-delay-fix-the-issue/1278170>\
**Category:** Blueprint\
**Tags:** delay, unreal-engine, Blueprint, question\
**Created:** [August 30, 2023, 10:19pm UTC](https://forums.unrealengine.com/t/properly-troubleshooting-accessed-none-error-with-dynamic-material-when-a-delay-fix-the-issue/1278170 "2023-08-30T22:19:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![woodencase01](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@woodencase01](https://forums.unrealengine.com/u/woodencase01)\
**Post date:** [August 30, 2023, 10:19pm UTC](https://forums.unrealengine.com/t/properly-troubleshooting-accessed-none-error-with-dynamic-material-when-a-delay-fix-the-issue/1278170/1 "2023-08-30T22:19:57Z")

</div>

Hey fellow Unreal Engine enthusiasts,

I’ve been working on a project that involves using a Widget to display the weapon ammo through a Dynamic Material. However, I’ve encountered a persistent issue with the “Accessed None” error during initialization (Begin Play), and I’m seeking some guidance on finding a cleaner and more reliable solution.

Here’s the problem:

**Scenario:**

- I have a “Set Weapon Material” function that configures the dynamic material to the Widget during Begin Play.
- Initially, connecting the “Set Weapon Material” directly to Begin Play causes the “Accessed None” error for the dynamic material.

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/4/8/34806904f564aa02d639bc1366c0fe581ec4eb63.png)

**Temporary Solution:**

- To resolve this, I’ve resorted to adding a “Delay Until Next Tick” node before the “Set Weapon Material” function, which seems to allow the asset to be referenced correctly.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/b/f/8bf7f8033c9386544240619ac99f760acab12106.png)

**New Issue:**

- As my game has expanded, the “Accessed None” error has resurfaced.
- The only workaround I’ve found is to add more “Delay Until Next Tick” nodes, which doesn’t feel like a reliable long-term solution. I don’t want to keep stacking delays as my project grows.

**Attempts Made:**

- I’ve tried using the “Async Load Asset” node, but without success.

Has anyone encountered a similar issue and found a cleaner, more dependable way to ensure assets load properly during initialization? I’d greatly appreciate any insights or alternative approaches to tackle this problem.

Thanks in advance for your help!

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [August 31, 2023, 10:14am UTC](https://forums.unrealengine.com/t/properly-troubleshooting-accessed-none-error-with-dynamic-material-when-a-delay-fix-the-issue/1278170/2 "2023-08-31T10:14:36Z")

</div>

What’s in ‘set weapon material’?

I mean, where are you waiting for the material to be valid? ( maybe you can show the area of code that’s giving you ‘none’ )

If you know it’s going to be ok, you can use a delay with a loopback, waiting for it

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/3/d/73dfc24641eeff0a9848d537d7c05a2f1477892e.png)

---

<div class="post-metadata">

**Author:** ![woodencase01](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@woodencase01](https://forums.unrealengine.com/u/woodencase01)\
**Post date:** [August 31, 2023, 11:55pm UTC](https://forums.unrealengine.com/t/properly-troubleshooting-accessed-none-error-with-dynamic-material-when-a-delay-fix-the-issue/1278170/3 "2023-08-31T23:55:59Z")

</div>

> [@ClockworkOcean](#):
>
> What’s in ‘set weapon material’?

Here is what’s inside, nothing complex:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/8/d/08d968af5f8c44092fba5bc7d7d52187922e7d38.png)

I’ll do as you suggested, I thought there was a better way of making sure a reference was loaded.

Would you see any situation where this “infinite loop” could fail?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [September 1, 2023, 7:21am UTC](https://forums.unrealengine.com/t/properly-troubleshooting-accessed-none-error-with-dynamic-material-when-a-delay-fix-the-issue/1278170/4 "2023-09-01T07:21:25Z")

</div>

> [@woodencase01](#):
>
> thought there was a better way of making sure a reference was loaded.
> 
> Would you see any situation where this “infinite loop” could fail?

I don’t think there is.

The only way it could fail is if the material never loads. Then you’ve got a problem anyway.

If you’re paranoid about it running forever ( I don’t think it would have much impact ), you can always exit the loop and give up after a certain number of tries 🙂

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [September 1, 2023, 7:16pm UTC](https://forums.unrealengine.com/t/properly-troubleshooting-accessed-none-error-with-dynamic-material-when-a-delay-fix-the-issue/1278170/5 "2023-09-01T19:16:52Z")

</div>

The base of the issue is the pawn is spawned some milliseconds after the controller. This why delays on begin play work as a hack.

You need to poll your references before initializing them.

Level loads gamemode, gamemode gets controller and spawns the pawn. It then executes possession. Controller → pawn

Wait until all is spawned, then reference.

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [October 1, 2023, 7:17pm UTC](https://forums.unrealengine.com/t/properly-troubleshooting-accessed-none-error-with-dynamic-material-when-a-delay-fix-the-issue/1278170/6 "2023-10-01T19:17:28Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
