Hello!
So this is a pretty simple question, yet it’s been bugging me for quite some time.
Even though I was developing my character and kept testing movement and such (everything worked good), all of a sudden the function “GetCharacterMovement()” stopped working, as it returns nullptr!
if (GetCharacterMovement() == nullptr)
{
GLog->Log("woah!"); // As you might guess, this runs! It is called in BeginPlay().
}
Funny thing is, that my custom character (derived from Character Class) actually has a CharacterMovementComponent on him, and if i try to get a reference to it with an iterator, I can perfectly do that!
//The following code works perfectly!
TArray<UCharacterMovementComponent*> Comps;
GetComponents<UCharacterMovementComponent>(Comps);
for (int32 i = 0; i < Comps.Num(); i++)
{
PlayerAwesomeMovement = Comps[i];
}
However, the function “AddMovementInput” no longer works for me, and my character is frozen in place forever.
Now, i have checked out this issue, and have found out that the most common roots of the problem are the following:
-
the movement is not replicated on a server - Check (It is)
-
the character belongs to a server, and not a client - Check (I am making singleplayer)
-
there are more than 1 character controllers spawned, and this creates a conflict - Check (Only 1 spawns!)
-
My Character does not have a “CharacterMovementComponent” - Check (It has!)
-
Building a custom CharacterMovementComponent in C++ - Check (nope, I am using all the basic one)
Now, do you guys have any idea what could be the source of this problem? Maybe I’ll try building up a custom movement system. It’s just weird as it was working perfectly until I am like 1-2 days worth of actual coding into the prototype.
Thank you for your time into this!