How to access a shape created in unreal editor

Hi,

I want to create a new actor class in c++ and I want to make a reference to a shape that someone will create in unreal editor.

I want to implement a overlap event that control the material of a shape but I don’t want to create the shape or the component that trigger the event, I want those component to be created in unreal editor.

Is that possible? is that the way unreal usually is programmed?

Thanks

Hello marceltoma,

I quite did not understand what do you mean. What exactly do you want to do?

I believe you want to attach your user made BSP to a class and change it’s properties?

yes.

In fact, I want to attach a event to a collision box in a blueprint, but the tutorials I had seem create the collision box in c++ and attach the event to it, is there a way to get the collision box I created in the unreal editor and attach the event to it?

Thank you very much.

Yes everything you can make in C++ cane be made in Blueprints.

So about your logic, I think you should create a blueprint that can hold your shape.

Then in your character blueprint, create a variable to hold that blueprint you just made. And then when you create the shape (spawning the blueprint) you set that same blueprint to the variable in your character.

From there you can access everything from your shape by just dragging that variable from your character. By the way, make sure you make shape’s blueprint variables public.

About the collision box. I believe that you need to make first the collision box, then attach to the collision box your shape. The structure would be
[Root] Collision box
ShapeModel

Thank you, OzoneBG

I understand now what I have to do in the editor.

Just 2 more questions:

  1. What is the type I use to that variable?
  2. What about the C++ code, how do I get the reference to that variable in the code?

Thanks for your help

  1. The type of your blueprint of the shape. For example if you named your shape’s blueprint: “BP_Shape”, then “BP_Shape” is your type of variable.

  2. Well just expose the variable to the blueprint with keywords such as “BlueprintReadWrite” / “BlueprintReadOnly”. You can find more information on them here.

No problem mate, the forum is to get help :slight_smile:

Feel free to ask more, if you didn’t understand something.