Change the Weapon Mesh during the game

Hi all,

My question is : How to change my weapon mesh during the game ?

I’m using a blueprint BP_BaseWeapon and his mesh is “Rifle”.

I want to change during game when a button is pressed the weapon’s mesh to another mesh “Launcher”.

Anyone know how do it please ?

Thanks :slight_smile:

Nobody have an idea ? :frowning:

It can be done simply by grabbing a reference to the old mesh and deleting it then spawning a new one and initializing it’s properties.

We are in C++ forum, I want to do this in C++ if possible ^^’

Thanks anyway for answer !

Destroy Weapon


void AWeapon::DestroySelf()
{
	Destroy();
}


Create Weapon


AWeapon* newWeapon = World->SpawnActor<AWeapon>(weaponType, socketLoc, FRotator(0));

Sorry for answer late, I see what you want to show me, it’s legit, but it’s impossible to change mesh during game without destroy and recreate the weapon ?

You can swap just the skeletal meshes, but then you have to swap out the properties of the weapon unless theyre the same weapon type. You can also do an initial spawn of all weapons and hide the ones you aren’t using, but then u also have a bunch of useless stuff in memory. Deleting them and recreating is super simple and probably at most only cause a small delay at time of spawn on slower machines. There are probably a few options in place for changing weapons that other people know about.

Ok I think I will use that, thanks for help !