[4.8.0 P1] Cannot (down)cast staticMeshComponent to primitiveComponent anymore

In my project, I made a blueprint script which has to work when attached to staticMeshActors as well as -components (inside of blueprints).

In construction script, it stores a reference to its parent (staticMeshActor/-component) in an array of primitiveComponents (seems to be only working way):


This worked without problems in UE 4.7.6. In UE 4.8.0 P1 it just silently broke wire to cast node and refuses to reconnect again.

Again, this worked in 4.7.6, so what could be problem here? Just a bug?

,

I wasn’t able to reproduce this in 4.8p1 with a new BP. I haven’t checked yet to see if it’s a conversion issue (4.7.6 to 4.8), but I’m curious if I’m setting this up correctly. To test, I created a new Actor BP and added a Scene Component. From that, I used Get Attach Parent node and Cast To PrimitiveComponent (all in Construction Script). With a new Primitive Component array variable, I was able to Add Unique with PrimitiveComponent cast.

I may be missing a step or two here. Is SelectionGroupComponents an array variable of type: Primitive Component? You mention using this BP to attach to Static Mesh Actors as well as components in Actor BPs… can you show me setup in more detail, or set up a test project for me somewhere?

Before any of that, do a quick check and delete Add Unique node and create a new one off of SelectionGroupComponents var, as sometimes converting up engine versions with node changes can make existing nodes function funny. Thanks!

Hi ,

thanks for investigating. Yes, selectionGroupComponents is an array of primitiveComponents. It just saves reference to either it’s parent staticMeshComponent or to a staticMeshActor (if directly attached to it). I needed a data type which works both with actors and components so I choosed primitiveComponent.

Your tip with recreating nodes is everything but bad, I did this many times on several conflicts. But in this case, it doesn’t work.

Hmm, so at least this should work (if I got you right), that’s good to read.

I changed variable type to an array of staticMeshComponents (instead of primitiveComponents). I had to manually recreate all add-nodes and for-each-macros by hand but at least it works now (for blueprints only, of course).

(Man, I really would dance on streets if we had real composable blueprints or prefabs…)

I tried this again, staring with a new project in 4.7.6 and converting it up to 4.8p1, and I still can’t reproduce. I imagine I must be setting something up differently than you. Would you mind setting this up in a new 4.8p1 project and uploading it somewhere so I can take a look? Thanks!

Hi ,

I will try to reproduce this with P2 (when it’s available) and report back then.

Follow up: I got same error in P2 but when I recreated all nodes, it worked for me. I’m ok with that, thank you.