# Modular weapon in UE4 editor

I want to create a modular weapon system. I already got most of it working, but I wonder how to make an improvement.

Weapons in my game have different firing modes (semi and auto) and "bullet" modes (projectile and hitscan). Each weapon is it's own blueprint, and there I can select proper one in editor, so for example an Uzi would be auto / histcan, while a rocket launcher would be semi / projectile. (the firing mode actor gets created at spawn from the class selected in editor).

I want to make it easier to edit by giving the weapon some variables, like spread and projectile blueprint. But not all of the variables apply to all the types of weapon...

TLDR: Can I create / show different variables in the editor, depending on other variables? If I choose projectile type of weapon, can I also select the projectile type, but not show the option if I chose hitscan?

Yes you can, Take a look at EditCondition meta specifier in UPROPERTY.

for example:

UPROPERTY( Category=Location, EditAnywhere )
uint32 bUseOffset:1;

UPROPERTY( Category=Location, EditAnywhere, meta=(EditCondition="bUseOffset") )
FVector Offset;


In this case the Offset will be editable only if bUseOffset is true.

Please also refer to: UE4 documentatoon

• Thank you very much. I will check it out in the morning! Apr 21 '19 at 3:38
• This is a link-only answer. It would be better if we had an answer which explains this itself instead of just linking users to another website which might one day break. May 10 at 7:20
• There's something similar to do it via blueprints also? Oct 7 at 20:47