I have the function:
.h void StopMusic();
.cpp
To Define it in a random place works but not in begin play.
void AMyCharacter::StopMusic()
{
//Logic
}
But to Define it in BeginPlay with its member class doesn’t work and gives error redeclaration out of member class.
So to make it work void StopMusic (){//Logic}
What do you mean by define it in BeginPlay()?
If you declare the function in .h, it’s a separate function and it must be defined in .cpp outside of other functions. Then you can call it on BeginPlay();
void BeginPlay()
{
Super::BeginPlay();
StopMusic();
}
void StopMusic()
{
// your logic here
}
I was trying to implement the function in the beginplay function, Thank You Sir for the solution… Thank You very very Much )
I Learned from You to just call the existing functions in BeginPlay and not to Define in beginplay.
Thank You.