Can't get sound or particle system to active.

I’ve spent the entire day trying to get this to work, but I’m still facing an odd problem.

In my header I have:


private:

UPROPERTY(Category = "Code|Effects", EditDefaultsOnly)
UParticleSystem* Jump_Particles; 
UPROPERTY(Category = "Code|Effects", EditDefaultsOnly)
USoundCue* Jump_Sound;

UPROPERTY(VisibleDefaultsOnly)
UParticleSystemComponent* Jump_PSComp;
UPROPERTY(VisibleDefaultsOnly)
UAudioComponent* Jump_AuComp;

In the editor I assign a pre-existing particle system effect and sound cue from StarterContents to the appropriate variables.

In my jump function in the .cpp file I have:


if (Jump_PSComp && Jump_Particles)
{
	Jump_PSComp->SetTemplate(Jump_Particles);
	Jump_PSComp->ActivateSystem(true);
}

else GLog->Log("No particles.");

if (Jump_AuComp && Jump_Sound)
{
	Jump_AuComp->SetSound(Jump_Sound);
	Jump_AuComp->Play();
}

else GLog->Log("No sound.");

As you may have imagined by the nature of this post I get ‘No particles.’ and ‘No sound.’ messages in my output log. Oddly I can get the code to work if I copy and paste the exact same thing from my jump function to BeginPlay(). What’s going on here?

Nothing comes to mind directly. Have you tried checking which of the two is NULL, Jump_PSComp or Jump_Particles?

Just tested all four variables. The problematic ones are:

Jump_Particles
Jump_Sound

In other words it’s the variables I’ve assigned from the editor. It’s odd because as I stated earlier, the code runs fine from BeginPlay().

It does sound odd, maybe you can post a bit more of your .cpp code?

For you? Anything.

Code Link Censored

Edit: The Jump() function is called as intended, because the GLog messages are visible every time I press the appropriate key. I’m using UE4.8 if that helps.

SOLVED

The problem was the way I spawned my actor. My idea of class inheritance mixed with blueprints was messed up which caused the problem.
By making a UBlueprint* variable exposed to the editor and dragging my player’s blueprint in there then using its GeneratedClass member variable to spawn it via my custom GameMode, I got it to work.
Not sure why BeginPlay() worked now that I think about it, but it works now so that’s good.

Thanks NisshokuZK for the assistance.