I have a custom Component that has a SceneComponent and a StaticMesh component that gets created with it in constructor of the SceneComponent. So the two components are really just one(I have reasons). Using this meta UCLASS(BlueprintType, meta=(BlueprintSpawnableComponent))
I’m using FComponentPicker with a filter to be able to pick said components in the editor. Here’s where things get dicey.
Let’s say I have 2 similar actors with the component
One of them is a blueprint with the components added in the CDO (not instanced)
The other is a c++ actor with the component added as an instance component.
If I use the component picker on the blueprint(When it’s in the level) to select the component on the c++ actor. I get this crash
If I pick the component any other way I do not get this crash. IE I pick in reverse and pick the blueprint’s component from the c++ actor. Am I missing some kind of behavior here? Seems like from the log that the details panel is causing the crash, but I can seem to figure out exactly why that is, and only with the blueprint version.
If you use the blueprint version to pick another blueprint version you also do not get this crash. Which I also find a bit strange.
I’m pretty sure at this point I can call it a bug. If someone else could properly reproduce to give me confirmation before I make a report that would be awesome.
To replicate:
Create a class in C++ inheriting from SceneComponent. Give it these UCLASS() metas
BlueprintType, meta=(BlueprintSpawnableComponent)
Add a component picker with this meta. Specifically what’s going to crash here is the AllowedClasses meta.
Now what you want to do is make a blueprint inheriting from actor (easiest) and add your c++ component to the class definition (not to an instance).
Add your BP to the world
Add a c++ actor to the world and add the component as an instance
Try to use the component picker on the BP to select the component instance on the c++ actor. You should recieve the same crash I have. Doing the opposite action (picking the component on the BP from the c++ actor components ComponentPicker) will not crash.
If you remove or change AllowedClasses meta to not include the class of the component you will not get this crash at all. It’s only when the class you are searching for is the class the FComponentReference is a member of.
I really want the filtering via AllowedClasses but for now I’m just not using it and forcing my team to search through all actors in the world.
No, and I’m still unsure exactly what causes that. Still solution is just to not use filtering or maybe you can implement a property customization with your own picker.
Ah gotcha I appreciate it. I hate not filtering the allowed classes. I’m currently getting around it by not adding the component with the FComponentReference property to bp, and instead just adding it via c++ wherever needed since the picker seems to never have any issues this way. Did you post a bug report on this?
This is my attempt at a succinct bug writeup based on my experience:
If you have an FComponentReference property that has the UseComponentPicker and AllowedClasses metadata specifiers like so:
UPROPERTY(EditAnywhere, meta = (UseComponentPicker, AllowAnyActor, AllowedClasses = "Activatable"))
TArray<FComponentReference> ComponentsToActivate;
If a property with these conditions is on a component, and that component is added to a blueprint, then using the component picker for that property from an instance of that blueprint will cause a crash. This crash does not occur when using the component picker for that property if the owning component is added via C++ construction OR when the component is added directly to any actor instance in a level.
I have not added it, because I was a bit unsure on what was actually causing the issue and at the time I didn’t have the mileage to go investigate. However, with at least one other person running into the same issue I think this qualifies for a report.