Accessed None error - adding something on the server and calling back to update the UI


Let me start off with the error I get:

Error Blueprint Runtime Error:
Accessed None trying to read property CallFunc_Array_Get_Item
from function: ‘FillSetsPannel’
from node: SetText (Text Box)
in graph: FillSetsPannel
in object: Collection
with description: Accessed None trying to read property CallFunc_Array_Get_Item

What should happen: (@dedicated server + 2 players PIE)
On the UI I cast to the player controller to call an event named “create new set”. It creates a new object of type Set and adds it to an array of Sets. The event is set to “run on server”. The array is on rep notify.

In the rep notify function of Sets[] I call the event dispatcher “sets did change”.
On the UI the dispatcher is bound (at first time creation) to an event wich calls a function “refresh sets pannel”.

The function fires - but when I want to loop over the Sets[] and access a member variable “name” - a string with some default value - I get the above error later after ending the PIE.

Eventhough theres a default value getting the string out of the set does not return the string…

Ive set everything to replicate on the Set and the Sets[] on the player controller aswell with the said notify…
There are sets in the array but the members of the set wont be initialized on the client it seems…

Can you help me?

Theres a few reasons why this may occur, without seeing the array get its hard to say. Off the top of my head though make sure the value you are trying to get is in range. Out of range Get on an array will trigger errors like that. May happen if your using any randomization in the get.

this is the function that is adding widgets for every set in the sets. the function is on the widget and will be called per event wich is assigned to the event dispatcher “sets changed” on the player controller wich will be called in the “on rep” function of the sets variable…

the SET was derived from Object, it only held the data for those 3 variables

I made a new SET wich i made of type struct. it works perfect now.

Btw I found the Solution while trying around with the old set class and reparenting it to actor and actor component…
I then couldnt reparent it to object anymore (eventho i did nothing and used nothing that requires it to be a component)

It was impossible to trick my way aorund this and i had to swap every reference to my old set with the new one… im happy i tried it with a struct first…

DONT USE “OBJECT” for online stuff - use STRUCTS…