#RPC trouble

1 messages · Page 1 of 1 (latest)

bitter swan
#

What's the issue?

spring sparrow
#

its not firing

#

client clicks button > no debug log on server

#

current setup is a exe client and editor host

bitter swan
#

Console warnings? Errors?

spring sparrow
#

none

#

although I can flip the test again and check

#

it runs on the client and not the server for some reason

bitter swan
#

Both Debug Logs run on the client?

spring sparrow
#

yes

bitter swan
#

That's.. not possible. Unless your client is the host.

You sure you have a valid set up going? A Host/Server starting up properly and a client making a valid connection?

spring sparrow
#

yeah, i have transforms replicating so far

#

this is just on a local connection

bitter swan
#

Well unless I'm missing something incredibly obvious, there's not much else I can help with without more information.

Server RPCs are pretty simple in NGO. Call one from a client in order to run the function on the server.

#

Can you show me the script Respawn() is defined in?

spring sparrow
#

is it because its not a networkbehavior?

bitter swan
#

That would be my first guess, yeah.

spring sparrow
#

is there a simple workaround or are my game systems going to have to be network objects?

bitter swan
#

You can use Singletons or Events if you want to send a message from a MonoBehaviour to a NetworkBehaviour

#

But yeah, where you can it's not a bad idea to organize networking logic in to NetworkBehaviours

spring sparrow
#

so, if i called a regular method in the network manager that called an rpc on itself, that would probably be a solution.

#

thanks for the help, testing

spring sparrow
bitter swan
#

@spring sparrow does the GameObject that has PauseMenu on it have a NetworkObject component on it?

spring sparrow
#

yes it does

#

but at this point im calling the rpc on the networkmanager object so..... it shouldnt matter

bitter swan
#

Right. But if that's the case PauseMenu doesn't need to have one or be a NetworkBehaviour.

bitter swan
# spring sparrow

This usually is the result of:
No NetworkObject on a GameObject that's in the hierarchy
A NetworkObject Prefab that's spawned at runtime isn't in the NetworkManagers list
Server isn't active

paper echo
#

Also before you to too far into this. Pausing a network game is going to be a bad time

spring sparrow
spring sparrow
bitter swan
#

Why does that make it difficult?

spring sparrow
#

what if I dont want to stuff literally everything in the player script?

paper echo
bitter swan
#

Then make another script that is a NetworkBehaviour. Just don't do it on the NetworkManager..

paper echo
#

it just needs a network object

spring sparrow
#

which means i have to make another sub object to handle all the network stuff

#

which is what the network manager is supposed to be

#

the new object that I create for all of this also has to be spawned on server side, so i cant even set these up in the editor it looks like, they need to be spawned

#

which means no setting up references in the editor.

bitter swan
spring sparrow
#

the player object

#

but instead of making it a player object it has to be all the background networking stuff on that object

#

meaning you now have to spawn a second object for the actual player.

#

it would be nicer if i could just call methods from any object.

#

unreal does the same shit.

bitter swan
paper echo
#

You can as long as it has a network object component on it

spring sparrow
#

I dont want to havbe 5 global objects just to handle game functions.

#

thanks for the help, ill do more testing today.

paper echo
spring sparrow
#

oh thank god

bitter swan
spring sparrow
#

right?

paper echo
spring sparrow
#

alright, ill look into it.