I’m not exactly sure what I’m doing wrong, but I can’t get my PlayerControllerComponent to Activate. This is called in GameStartup:
EBUS_EVENT(AZ::ComponentApplicationBus, RegisterComponentDescriptor, Vx::PlayerControllerComponent::CreateDescriptor()); //Added from Multiplayer example
I tried a few different things, between switching from using ActionMapping / IInput to capture keyboard / mouse controls.
Everything compiles fine, and can get into the level with the actor initialized and custom settings:
bool TestGameRules::OnClientConnect(ChannelId channelId, bool isReset)
{
return gEnv->pGame->GetIGameFramework()->GetIActorSystem()->CreateActor(channelId, "Player", "Actor", Vec3(100, 100, 30), Quat(Ang3(0, 0, 0)), Vec3(1, 1, 1)) != nullptr;
}
And realized that no where is this being called :
void PlayerControllerComponent::Activate()
{
AZ::TickBus::Handler::BusConnect();
IActionMapManager* actionMapManager = gEnv->pGame->GetIGameFramework()->GetIActionMapManager();
if (actionMapManager)
actionMapManager->AddExtraActionListener(this, "player");
}
Hence, no tickbus connect, or actionMap listener.
Debugging seems to go through:
ComponentDescriptorHelper::ComponentDescriptorHelper()
PlayerControllerComponent::Reflect()
ComponentApplication::RegisterComponentDescriptor()
but then continues through the normal CryAction loading / game loop.
I’ve also regenerated a UUID, and searched for name conflicts; thinking that it might be an issue, but still no luck:
AZ_COMPONENT(PlayerControllerComponent, "{23166B3B-845C-4B27-B603-8E44C4CA7E3C}");
I must be doing something wrong.
Does anyone have anything I’ve missed from the documentation that would cause this not to Activate()?
EDIT: I see the PlayerController component in the Editor, so it’s being registered. It seems I need to figure out how to attach it to the C++ Actor I created.