Page MenuHomeFeedback Tracker

EntityID gets replicated as null pointer in array<EntityID>
New, NormalPublic

Description

When trying to replicate a variable of type array<EntityID>, the elements end up as null pointers on the receiver.

Details

Severity
None
Resolution
Open
Reproducibility
Always
Operating System
Windows 11 x64
Category
General
Steps To Reproduce
  1. Open workbench
  2. Add the code below to a script file
//------------------------------------------------------------------------------------------------
modded class SCR_BaseGameMode : BaseGameMode
{
	//------------------------------------------------------------------------------------------------
	override protected void OnPlayerSpawned(int playerId, IEntity controlledEntity)
	{
		EntityID entityID = controlledEntity.GetID();
		array<EntityID> entityIDs = {entityID};
		RpcDo_PrintEntityIdBroadcast(entityID, entityIDs);
		Rpc(RpcDo_PrintEntityIdBroadcast, entityID, entityIDs);
	}
	
	//------------------------------------------------------------------------------------------------
	[RplRpc(RplChannel.Reliable, RplRcver.Broadcast)]
	protected void RpcDo_PrintEntityIdBroadcast(EntityID entityID, array<EntityID> entityIDs)
	{
		SCR_ChatComponent chat = SCR_ChatComponent.Cast(GetGame().GetPlayerController().FindComponent(SCR_ChatComponent));
		if (!chat)
			return;
		
		chat.ShowMessage(string.Format("entityID = %1 vs entityIDs = %2", entityID, entityIDs));
	}
}
  1. Compile and load MpTest.ent in the world editor
  2. Go to play mode with one peer client
  3. Check reported EntityID in chat on the peer client.

Event Timeline

ookexoo created this task.Mon, Dec 2, 2:42 AM