Array problems

I’ve been haunted with constant array problems when trying to add or read from one blueprint to another. When trying to standalone, launch or package the game the blueprint that is trying to access another blueprints array will fail to compile. Most of the time its just this kind of error:

[2014.09.26-21.44.06:938] 0]LogBlueprint:Error: [compiler] Error GM Snake Array of type array[object’self’] doesn’t match the property GM Snake Array of type array]
[2014.09.26-21.44.06:940] 0]LogBlueprint:Warning: [compiler] Warning [0012.01] Compile of BP_RB_SnakeTest failed.

The blueprint I am trying to access is either the Game Mode BP or the main Main game BP that handles all the logic in the level and is the only persistent actor. I have quite a few arrays that work properly but they are only accessed by the BP they are in. Like I said earlier I ran across this problem many times and have had to come up with a way to handle the construction of the array in the BP itself then communicating it with another blueprint but with my current issue I can’t seem to find away to do that.

So what I’m doing is adding a Variable to my Game Mode BP as " Array of type Actor = BP_RB_SnakeTest " and making it editable. Then when I spawn actors of class “BP_RB_SnakeTest” they cast to Game mode and add themselves to the array. As always it all works fine in the editor but when I launch the game in standalone, launch or package the BP which is casting to Game Mode fails to compile.

Im starting to think that i am setting this up all wrong somehow but the other arrays work fine so I am a bit lost now, would really appreciate any insight anyone has to offer as this has plagued me since the start of the project.

So I have tried a different approach to this and still yield the same results, I get a variable as object “Self” even though Im adding it into array before applying it to the variable I need but still end up with a reference as " Object “Self” When I try this in a brand new project I get the same results so I doubt its a project corruption. All I need is a array of actors spawned from the same class, which I can add to and remove from the class blueprint. Can anybody point me in the right direction? Any help would be greatly appreciated.

Error on compile:
[2014.09.27-17.57.45:071] 0]LogBlueprint:Error: [compiler] Error Snake Array of type array[object’self’] doesn’t match the property Snake Array of type array]
[2014.09.27-17.57.45:072] 0]LogBlueprint:Error: [compiler] Error Snake Array of type array[object’self’] doesn’t match the property Snake Array of type array]
[2014.09.27-17.57.45:073] 0]LogBlueprint:Warning: [compiler] Warning [0008.18] Compile of BP_RB_SnakeTest failed.

My new attempt that yield same results:
3120fed2c437841b77f13894c8fa7c1bb5c69d68.jpeg

Hello,
i have no idea to help you but i would try first a new array with a new name without spaces and anything in special. Then i would try a migrate to a new project and try if same event occurs. In hope it helps you…

Have you try to “set array element” too ? with “size to fit”

When I migrate it to a clean project I get the same results. I had not tried " set array element " or changing the name to a single name but just tried it and get the same results. I end up with a Error in the blueprint that [object’self’] is not compatible with the array. Ive now tried saving this variable in anyway possible, “Object”, “Actor” or in a Array of the blueprint like show in my screen shots. How is it possible to get a variable of a certain instance of a actor without it being labeled “Self” . :frowning:

Thanks for the suggestions though!

Weird thing is that you save same value in 2 identical arrays and one seems no troubling. Can’t you use it ? like loop : when item = actor then action ?

Both of the Arrays work fine in the one main BP that spawns the enemies, when i visually debug and run the lines both arrays are populated. One array the “Self Spawned Enemies” is a generic “Actor” Array that all enemies I spawn in go into, so if the player dies i can destroy everything and clear the Array. The other Array is what I have been trying to pass along to the BP_Snake_Test, I tried just using a Actor Array but then I cant use my reference to call certain functions in the instance when it spawns. So I added a variable in the BP called " I am this instance " that gets set with the reference you get when you spawn a actor, or I am trying to anyway. When I just use get reference to self inside the BP_SnakeTest I get the same results.

What I’m trying to do is create a snake enemy like you see in classic shoot em ups, it has a head and a body that follows in a snake like movement. This is how I have been testing it:

6d1785d15f088330d6efac1ffe6e9c23a07e0003.jpeg

Just an idea : On first picture : you cast twice your gm. The second one can be deleted. Maybe totally useless, maybe the double cast does a trouble… I continue trying to figure what can do that…

Since the first post I took the Array out of the Game Mode BP and added it to the Shooter Controller BP, to see if that solved the issue but it resulted in the same. I now have tried to make a totally new Blueprint called BP_Data and added it as a persistent actor to the level to only hold the Array data. Well that did the exact same thing as the other Blueprints which is getting a Reference to Object"self" , i feel like I most be going about this wrong somehow. The weird thing is that everything works fine in the editor, the head spawns and the tail actors follow, when the head dies the other actor next in line becomes the head and continues along the timeline like it was the original head. Its getting very frustrating. Thank you for the help btw.

I just made a spaghetti mess by trying to “get all actors of class” as soon as each actor is spawned then adding them to the array that way but the compiler still reads them as [object"self’] on load… Im starting to think that this is all bugged some how, does anyone know if this is standard behavior and I need to figure out another way of getting a list of these actors?

2014.09.28-00.10.04:395] 0]LogBlueprint:Error: [compiler] Error SnakeArray of type array[object’self’] doesn’t match the property SnakeArray of type array]
[2014.09.28-00.10.04:396] 0]LogBlueprint:Error: [compiler] Error SnakeArray of type array[object’self’] doesn’t match the property SnakeArray of type array]
[2014.09.28-00.10.04:397] 0]LogBlueprint:Warning: [compiler] Warning [0009.36] Compile of BP_RB_SnakeTest failed.

After all those tries, i think you would try to ask on answerhub to have epic staff help. We are sunday but maybe tomorrow someone will have time to check.

Thanks for trying to help, Went ahead and did what you suggested.

https://answers.unrealengine.com/questions/105763/adding-on-spawn-to-a-array-and-getting-objectself.html

So after reading the preview for 4.5 I found this " Array properties with external Blueprint dependencies were not being fully loaded prior to generating the Blueprint class on load; fixed." After testing this set up in 4.5 preview my issues were resolved and figured Id update this.