4/12/2023 0 Comments Unity 5 networkview rpc![]() And it can save performance since you can call these RPC calls only when needed. I know it's a lot of work to do but believe me it's not slower than the regular networkView that sync transform since you can send what you need exactly, for example if you don't care about rotation but just want the position. RPC calls have limited arguments (int, float, string, NetworkPlayer, NetworkViewID, Vector3, Quaternion) so if you want to send objects you have to be creative, for example if an object has 2 int and 1 float you can send your object in pieces or even better in a single Vector3 then deal with its component in the receiving function.Īs for animations I haven't tried it before in RPC but I think you can send the name of the animation and the current time of the animation. Objects need velocity to actually push another object. If the receiver will collide with object then I send velocity too because if an object(A) is just translating and touch another object(B) while (A) has velocity = 0 then it will just move (B) a little instead of pushing it. Well, if I need to sync transformation and send RPC at the same time I set the networkView to RPC mode and send all the info I want in one RPC function, I can't send transform directly due to RPC argument type limitation but I send the position and rotation and make the receiver object translate to this position and rotate. i tried to call the rpc function on the target player insted from w$$anonymous$$t$$anonymous$$n my player like t$$anonymous$$s: ("RPCFunctionName", targetNetworkPlayer, arg1, arg2) īut with no result, i tried also to activate the gameObject that the networkView is attached to before starting the game becuz the player starts with the cild that t$$anonymous$$s networkView is attached to deactivated, the same errorĪny help will be appreciated and if i misunderstood the functionality of allocating view ids any coorection will be appreciated To clear t$$anonymous$$ngs out each player has $$anonymous$$s own 4 networkViews i mentioned earlier so in my opinion i can't just send rpc function from my networkView to another player's networkView even if they share the same script am i right ? (each player prefab has these networkViews), so i tried to forward the rpc function to the server and then the server forward it to the target client and actually it worked some times but now not. Strange behaviour may occurĬouldn't invoke RPC function 'FunctionName' because the networkView 'SceneID: 0 Level Prefix: 0' doesn't exist View ID AllocatedID: 0 Level prefix: 0 not found during lookup. seems no problem until now but the annoying message that keeps popup is when i send an rpc call to another client Network.Instantiate(playerPrefab, new Vector3(startPosX, startPosY, startPosZ), Quaternion.identity, 0) Įach player prefab has multiple network views for different tasks (two for transform and animation sync and another two for rpc calls), i implemented a private chat app that each client can chat directly to another client connected to the server. spawn the player on connected to server ![]() when OnConnectedToServer(), a player character is network instantiated with a set of preallocated networkViews void OnConnectedToServer() Hi every one I assume that my question is very simple but actually i spent hours or even days to solve my problem withuot any result, now i have a simple non-authoritative server game in w$$anonymous$$ch whenever a player connects to the server i.e. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |