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

woodencase01
Wed, 30 Aug 2023 22:19:57 +0000
Blueprint

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.

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.

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!

6 posts - 4 participants