It depends on the order. If you initialize the ParticleGun in your generator constructor, then the UI command will override it. If you have the explicit SetParticleEnergy call in your generator’s GeneratePrimaries() function, then the function will override the UI command.