Warning when Resources.LoadAll

Hi I’m getting a warning that is cluttering up my console and I’m trying to get ride of it. The warning is telling me that no “AbilityData” component can be found on the “Core” object. This is known and desired.

My understanding is this line of code should find everything in the resources folder with a AbilityData component on it and ignore everything else. Am I missing something?

AbilityData[] effects = Resources.LoadAll<AbilityData>("");
The referenced script on this Behaviour (Game Object 'Core') is missing!
UnityEngine.Resources:LoadAll<Game.AbilityData> (string)
Game.AbilityLookup:get_All () (at Assets/Game/Scripts/Shared/Gameplay/Actions/AbilityBehavior.cs:325)
Game.Ability:get_data () (at Assets/Game/Scripts/Shared/Gameplay/Abilities/Ability.cs:89)
Game.UIEncounterCombatPanel:SetupButtonsPlayerOwner (Unity.Netcode.NetworkList`1<Game.Ability>) (at Assets/Game/Scripts/Client/Content/UI/DM/UIEncounterCombatPanel.cs:90)
Game.UIEncounterCombatPanel:Update () (at Assets/Game/Scripts/Client/Content/UI/DM/UIEncounterCombatPanel.cs:72)

This is correct.

Yes… look again at the callstack. It’s your code having the problem. :slight_smile:

Are you calling stuff in Awake() or OnEnable() that perhaps should be called in Start() ?

Still not seeing it. The callstack is erroring out on line 325
7893799--1005079--upload_2022-2-13_13-21-6.png

7893799--1005085--upload_2022-2-13_13-26-56.png
The block of code above is called from an Update here:
7893799--1005082--upload_2022-2-13_13-25-9.png

it executes properly and runs as I’d expect. The data is not null. The selectable are setup. I just get that warning.

Is UIEncounterCombatPanel.Update() just a regular old bog-standard MonoBehaviour Update() method?

Any chance this code is being called from a field initializer? Object constructors for things made by Unity (including field initializers) are not called on the main thread, so you cannot use Unity API functions.

Yup just a good old monobehavior update() method.