Problem with the PunRPC [SOLVED]
Options
Hello,
I'm trying to send a RPC to the other client with 2 parameters.
Like this:
GetComponent().RPC("SendAlchemySolutionToClient", PhotonTargets.Others, randomPotionIndex, randomPathIndex);
randomPotionIndex and randomPathIndex are both int[ ].
They both seem to arrive at the client but once i loop through the randomPathIndex i get an error.
This is the error:
NullReferenceException: Object reference not set to an instance of an object; (wrapper stelemref) object:stelemref (object,intptr,object).
The loop code looks like this:
private void SendAlchemySolutionToClient(int[] randomPotionIndex, int[] randomPathIndex) {
for (int i = 0; i < solutionAmount; i++) {
chosenPotions[i] = potionsSolution[randomPotionIndex[i]];
chosenSolutions[i] = chosenPotions[i].pathsToSolution[randomPathIndex[i]]; <----Causing the error
}
}
Is it simply not possible to send the int [ ] through a RPC or might there be something else that i've missed.
Any help would be appreciated,
Total Mayhem Games
I'm trying to send a RPC to the other client with 2 parameters.
Like this:
GetComponent().RPC("SendAlchemySolutionToClient", PhotonTargets.Others, randomPotionIndex, randomPathIndex);
randomPotionIndex and randomPathIndex are both int[ ].
They both seem to arrive at the client but once i loop through the randomPathIndex i get an error.
This is the error:
NullReferenceException: Object reference not set to an instance of an object; (wrapper stelemref) object:stelemref (object,intptr,object).
The loop code looks like this:
private void SendAlchemySolutionToClient(int[] randomPotionIndex, int[] randomPathIndex) {
for (int i = 0; i < solutionAmount; i++) {
chosenPotions[i] = potionsSolution[randomPotionIndex[i]];
chosenSolutions[i] = chosenPotions[i].pathsToSolution[randomPathIndex[i]]; <----Causing the error
}
}
Is it simply not possible to send the int [ ] through a RPC or might there be something else that i've missed.
Any help would be appreciated,
Total Mayhem Games
0
Comments
-
I just found the solution. It had nothing to do with Photon.0