- Status
- Offline
- Joined
- Mar 3, 2026
- Messages
- 546
- Reaction score
- 7
Ran into a brick wall with Phasmophobia network logic lately. The game micro-stutters and immediately shuts down whenever a Photon RPC target is set to All. Interestingly, setting it to Others doesn't trigger a crash, but it also doesn't seem to execute anything meaningful on the remote end.
This behavior usually points to a native exception occurring when the local client tries to parse its own malformed RPC packet. If the logic is only failing when you have to process the call, the issue is almost certainly in how the parameters are being packed or how the method signature is being interpreted by the IL2CPP runtime.
The Current Setup
Using the IL2CPP_Resolver for export resolution. The calling convention is defined as __fastcall.
Boxed Value Implementation
Technical Breakdown & Risks
If you've managed to get string-based RPCs working using IL2CPP::String::New, it confirms your general RPC invocation logic is fine. The crash here is strictly tied to the stack mismatch or the boxing of the boolean value.
Has anyone else encountered issues with PhotonMessageInfo parameters specifically in Phasmophobia? Drop your thoughts or crash logs below.
This behavior usually points to a native exception occurring when the local client tries to parse its own malformed RPC packet. If the logic is only failing when you have to process the call, the issue is almost certainly in how the parameters are being packed or how the method signature is being interpreted by the IL2CPP runtime.
The Current Setup
Using the IL2CPP_Resolver for export resolution. The calling convention is defined as __fastcall.
Code:
auto lp = SDK::GetLocalPlayer();
if (!lp) return;
if (auto punView = lp->fields.view; punView && punView->fields.viewIdField != 0) {
dprnt("Photon view id: {}", punView->fields.viewIdField);
static auto sysObjClass = IL2CPP::Class::Find("System.Object");
auto paramsArray = SDK::Array::Il2cppArrayNew(sysObjClass, 1);
bool diedOrDisconnected = false;
static auto sysBoolClass = IL2CPP::Class::Find("System.Boolean");
paramsArray->At(0) = SDK::CreateBoxedValue(sysBoolClass, &diedOrDisconnected);
// Signature: void ForceDropPropsNetworked(bool diedOrDisconnected, PhotonMessageInfo info)
reinterpret_cast<Unity::CComponent*>(punView)->CallMethodSafe<void*>("RPC", IL2CPP::String::New("ForceDropPropsNetworked"), SDK::RpcTarget::All, paramsArray);
}
else {
dprnt("Photon view was null");
}
Boxed Value Implementation
Code:
Unity::il2cppObject* SDK::CreateBoxedValue(Unity::il2cppClass* klass, const void* value) {
static auto resolvedValueBox = IL2CPP::UnityAPI::ResolveExport("il2cpp_value_box");
if (!resolvedValueBox) return nullptr;
using Il2cppValueBox_T = Unity::il2cppObject*(UNITY_CALLING_CONVENTION)(Unity::il2cppClass*, const void*);
auto il2cpp_value_box = reinterpret_cast<Il2cppValueBox_T>(resolvedValueBox);
return il2cpp_value_box(klass, value);
}
Technical Breakdown & Risks
- Parameter Mismatch: The method ForceDropPropsNetworked expects two arguments: a boolean and PhotonMessageInfo. The current code only populates a params array of size 1. When the local client (Target: All) tries to invoke this, it looks for that second argument on the stack. If it's missing, you hit an access violation or an IL2CPP internal failure.
- Boxing Issues: While il2cpp_value_box is the standard way to handle value types (bools, ints) in an object array, any misalignment in the class pointer passed to the resolver will result in garbage data.
- PhotonView State: Ensure the PhotonView ID is valid and networked. If the view is suppressed or in an invalid state, the RPC handler might throw a fit.
If you've managed to get string-based RPCs working using IL2CPP::String::New, it confirms your general RPC invocation logic is fine. The crash here is strictly tied to the stack mismatch or the boxing of the boolean value.
Has anyone else encountered issues with PhotonMessageInfo parameters specifically in Phasmophobia? Drop your thoughts or crash logs below.