Closed laughxing closed 1 month ago
Does this only happen to the properties of the TObjectPtr
type? We have a similar issue: #26
lack of description, I don't fully understand what #26 is about. In our case, it's cause by different memory layout between editor and packaged game/server binary.
currently we generate replication code using the reflection info generated in editor. for example
#if WITH_EDITORONLY_DATA
int PropA;
#endif
int PropB;
so the memory offset of PropB would be sizeof(int), which is used in some replication code.
// init
PropA_ptr = (uint8*)ContainerAddress + 0;
PropB_ptr = (uint8*)ContainerAddress + 4;
//set state
*PropA_ptr = state->prop_propA()
*PropB_ptr = state->prop_propB()
When we package the game, with WITH_EDITORONLY_DATA leaved out , the actual memory offset of PropB will be 0 in both Client/Server binary. but the replication code is not updated(only generated in editor), which will lead to some undefined behaviors.
There are two ways to support conditional compilation properties:
there's some code like this:
some property is replicated using pointer to their memory location. when we package the game, the memory offset will be different.