#so i was trying to spawn objects as the
1 messages · Page 1 of 1 (latest)
Check for any console errors. You'll need to make sure that this is only getting called after OnNetworkSpawn().
no errors
i got an error because for server rpc i need ownership so i changed it to RequireOwnership = false
now no errors, so idk what's wrong
Make sure that this is in a network behavior and that the network object is spawned
i mean for the host it works
@north sluice maybe it's because it's not on the player itself but on a planet? (on planets on the map you can spawn ships) that's why it said i don't have ownership too
If the planet was in the scene when the scene was loaded then it should still work. Otherwise the planet needs to be Spawned too
It's from the start there
So idk why :(
So the RPC is not getting called at all?
Also your while loop there is going to be infinite when it does get called. Spawned is only getting set true on the server and not the client. You would need to make it a network variable if you need that value symced
The "non server spawn" debug i placed there is not getting called so yeah
When is the coroutine getting called? Is should be called in OnNetworkSpawn or later
the coroutine runs. that's not the problem
the function serverrpc is on completely doesn't do anything
If the runs too early, the serverRPC will do nothing since the object is not on the network yet
this is an "build space ship" coroutine. it doesn't run on start, only if you press it on the ui
Ok, does the planet have a network object?
If the network obect has been spawned and this in in a network behavior then there is no reason a serverRPC won't run
🤷🏻
NGO doesn't use SyncVar. You would make that a network variable
kk
@north sluice so, it seems like the planet's network object where the script is on is not working. on start of the game it doesn't spawn. and if i do manually i get this
(when spawning the network object)
Are you using NetworkManager.SceneManager to load the scene?
That should work too. If the planets are in that scene and enabled then they be spawned
that's how it looks on start
they are in the scene and enabled
Weird. Try moving network object up to the top. Though that shouldn't matter anymore
oh wait it worked now,
i removed,
a network object from the scene
that was a network prefab
(not the planet)
for some reason they had the same Id
weird
Huh, that should have given an error message
in game dev. i always think either i am dumb or unity is. most of the time it's both
xD
it did but not for this. it told me i can't spawn the other object or something, but i had problems with the planet