PRC call error,when the two same components in a gameobject
Options
I have a component called shooter. And I have multi shooter components on my player game object. If I use PRC call shoot function of a shooter. It will cause an error, "NullReferenceException: Object reference not set to an instance of an object"
I think it caused by multi shoot function in the same gameobject, but I need many shooters in my player gameobject so I can stack many shooting ways up. How can I tackle this issue?
I think it caused by multi shoot function in the same gameobject, but I need many shooters in my player gameobject so I can stack many shooting ways up. How can I tackle this issue?
0
Answers
-
Does someone know how can I use RPCPun to call a function which is not just one in the same game object?0
-
Hi,
we are investigating this internally and will see if we can come up with something.
right now, your best approach would be either to combine shooters in one component featuring a list of shooting properties, then you have one RPC. or have a proxy "Shooters" that receive the RPC and forward all to all shoot components found on that gameobject. Shoot component would not implement the rpc method directly.
Bye,
Jean0 -
OK, thanks for your suggestion. I will try.0
-
Hi,
yes, I got the confirmation that we won't support this, it's by design, so indeed make a proxy to catch the rpc and dispatch yourself after.
Bye,
Jean0 -
Got it, thank you.0
-
OK, thank you!0