#archived-networking

1 messages · Page 32 of 1

vivid zodiac
#

Quick Question, Why am i not able to add the On Client Side Network Transform from the Netcode for Gameobjects using Git URL

sharp axle
ocean wadi
#

I had a question regarding Netcode's .Spawn method. I was wondering if .Spawn recreates a copy of the object it is used on or the object's prefab? An example of why I need to know would be a dash special effect that leaves afterimages of the player. The prefab's sprite renderer starts off null, but is dynamically set to the player's current sprite. If I were to spawn the object, dynamically set the afterimage sprite, then call .Spawn, would the client side afterimage's sprite renderer be null or would it be the same sprite saved in the object?

tame slate
sharp axle
ocean wadi
# sharp axle You would need to set the sprite in that new objects OnNetworkSpawn()

If I was using an object pooling system and the method SpawnFromPool. Would I want to call .Spawn in SpawnFromPool or whatever code is calling SpawnFromPool? A problem I thought of was that if we call .Spawn in SpawnFromPool, but we need to change certain values of the spawned object after spawning, we wouldn't be able to use OnNetworkSpawn right?

sharp axle
#

If you are using Network Object Pooling then you can use NetworkObject.Spawn() as normal. OnNetworkSpawn() still gets spawned

Netcode for GameObjects (Netcode) provides built-in support for Object Pooling, which allows you to override the default Netcode destroy and spawn handlers with your own logic. This allows you to store destroyed network objects in a pool to reuse later. This is useful for often used objects, such as projectiles, and is a way to increase the app...

vivid zodiac
vivid zodiac
sharp axle
vivid zodiac
#

Only got :

In Local Space
Interpolate
Slerp Position
Use Quaternion Synchroni
Use Half Float Precision
vivid zodiac
sharp axle
#

oh this is only in NGO 2.0+ for Unity 6

vivid zodiac
#

that explains it

#

but then i wouldn't have problems with installing the Client Side Network Transform tho?

sharp axle
#

I don't know if NGO 1.11 or 1.12 has it though

tame slate
# vivid zodiac but then i wouldn't have problems with installing the Client Side Network Transf...

@vivid zodiac it's a really simple script, you can just create it yourself.

using Unity.Netcode.Components;
using UnityEngine;

namespace Unity.Multiplayer.Samples.Utilities.ClientAuthority
{
    /// <summary>
    /// Used for syncing a transform with client side changes. This includes host. Pure server as owner isn't supported by this. Please use NetworkTransform
    /// for transforms that'll always be owned by the server.
    /// </summary>
    [DisallowMultipleComponent]
    public class ClientNetworkTransform : NetworkTransform
    {
        /// <summary>
        /// Used to determine who can write to this transform. Owner client only.
        /// This imposes state to the server. This is putting trust on your clients. Make sure no security-sensitive features use this transform.
        /// </summary>
        protected override bool OnIsServerAuthoritative()
        {
            return false;
        }
    }
}
vivid zodiac
sharp axle
vivid zodiac
#

That's literally just the whole script?

tame slate
vivid zodiac
#

I expected it to be atleast 100 lines

#

But thanks very much guys!

covert gull
#

Anyone here familiar with steamworks and can explain to me the difference between a CallResult and Callback? I understand how delegates and events work in regular C#. I don't understand the difference between these two types

normal cypress
#

is there any other samples for the ReadDelta and WriteDelta of the custom NetworkVariable? I hope they can just include it in the docs instead of just saying // Do nothing for this example.

fluid walrus
#

you can send an RPC with a NetworkObjectReference

tame rampart
#

how should I send an rpc to a specific client? I looked at the docs and there are examples using ClientRpc but apparently its deprecated

tame rampart
#

ah okay it looks like RpcTarget.Single((ulong)clientId, RpcTargetUse.Temp) something like this

#

I don't know what RpcTargetUse really is though

#

the docs aren't very helpful

sharp axle
tame rampart
sharp axle
tame rampart
#

your example uses clientRpcParams, which I was under the impression is only able to be passed into a ClientRpc, which is deprecated now

#

like this

plucky bramble
#

oh nvm

tame rampart
#

sorry yes, legacy

tame rampart
#

I figured out how to do what I want (i think) so dont need to worry about me

tame rampart
#

I tried googling how to make a gameobject be client authoritative, and this old out-of-date documentation page is what showed up

#

does anybody know the current way I should do this?

sharp axle
tame rampart
#

isn't this just for position?

#

well, the transform

sharp axle
# tame rampart well, the transform

yes. For Network Variables, you can set the write permissions to owner

NetworkVariables are a way of synchronizing properties between servers and clients in a persistent manner, unlike RPCs and custom messages, which are one-off, point-in-time communications that aren't shared with any clients not connected at the time of sending. NetworkVariables are session-mode agnostic and can be used with either a client-serve...

tame rampart
sharp axle
tame rampart
#

is there a way to get the owning client id from a player gameobject?

#

or should I cache the client id at the start of runtime

tame slate
#

Caching is never a bad idea however

copper pumice
#

Hey,
I'm getting an issue with multiplayer playmode, but not sure if it's auth related or multiplayer play mode related.
I'm using Unity6 (6000.0.26f1) and multiplayer services 1.0.2
Running platform profile (Default Windows)
And when I activate Player2 I have a logic that initializes unity services then signs in anonymously
(I initialize unity services using default ctor without init options)
When I try it out in the main editor it's fine, but on the 2nd editor (Player002) it throws an error exactly when I try to sign in anonymously
Saying
Unity.Services.Authentication.AuthenticationException: invalid environment name provided ---> Unity.Services.Authentication.WebRequestException: {"detail":"invalid environment name provided","details":[],"status":400,"title":"INVALID_PARAMETERS"}

Am I asking this in the right place?

NOTE:
I also get the same error in default editor when I switch to "built profiles" but when choosing the default profiles everything is fine.

sharp axle
tame rampart
#

if I call Despawn on a gameobject (server authority), does that mean Update() will stop being called for it?

copper pumice
copper pumice
#

Oh wait, you said Despawn not destroy

tame rampart
#

I mean like does it happen immediately - is there a guarantee that the next tick Update() won't be called for a networkobject that I called despawn on last tick

copper pumice
#

Hmm good question,
Maybe worth doing a test in your client and server Update method
Keep firing logs and also fire a log when it's destroyed/despawned
You'd be able to see if a log in Update gets fired after despawn

sharp axle
#

There is also a DeferDespawn() that will delay it by a certain number of ticks

tame rampart
#

thanks, makes sense

tame rampart
#

One more thing - on a network behaviour script, who is allowed to modify variables? I mean ones that aren’t explicitly declared NetworkVariables

#

And is the prefab for a player that is specified in the network manager a special case or the same as any other network behaviour script

#

far as I can tell it's server authority for these

#

in which case, is this only working because I have a NetworkTransform component with client auth mode?

sharp axle
tame rampart
#

I have a NetworkObject that starts in the scene and I want to cache a reference to one of it's components in my player's NetworkBehaviour script.

#

I think this works? tested and no crashes or unexpected behavior

#

at a high level I want items (like dropped stuff in minecraft) be able to interact with the correct inventory of a player thats nearby

sharp axle
tame rampart
sharp axle
#

also IsOwner is not properly set there either

tame rampart
#

thanks

#

one last thing - I feel like I don't super understand how it works when there's a host

#

it's a client that is also the server

#

meaning - if I write in my player script code that modifies variables (without a server rpc), it'll actually make the changes, but only in the host instance? other client instances will also try to run the code locally but it won't actually change variables?

fluid walrus
#

a lot of the time you want to be checking IsOwner in Update etc so clients only update their own objects and the host doens't try to update other clients' objects

sharp axle
tame rampart
#

yeah - I mean for like regular variables (in a networkbehaviour)

#

I feel like i didnt explain what i meant very well

sharp axle
#

regular variables are always local and will never get replicated to other clients/the server

tame rampart
#

lets say i have a networkbehaviour script on a networkobject and it has a variable public int x = 0, and then inside Update() I do something like x = 5;

#

dang im confusing myself

#

but essentially for clients the modification will be ignored by the server right?

#

because it's server write perms only

#

i'd have to do rpc server call from client to request the server modify x, or make x a NetworkVariable<int>

sharp axle
tame rampart
#

makes sense - and for the host, it only has one copy of x between its client and server?

sharp axle
tame rampart
# tame rampart

I see now.. in this code I'm just changing the host's local variables. Other clients don't actually have updated local versions, which I imagine will lead to unexpected behaviors (if im not careful)

sharp axle
tame rampart
#

would it be better to have a NetworkVariable that holds a reference somehow?

#

I know it's not possible to do NetworkVariable<MyCustomComponent>

#

is it allowed to do NetworkVariable<NetworkObjectReference>

sharp axle
tame rampart
#

oh thats awesome, that's probably the way i want to do it

tame rampart
#

I tried to refactor but I'm running into this problem

#

I can't any examples in the documents where they use a NetworkObjectReference or NetworkBehaviourReference as the type for a NetworkVariable

sharp axle
# tame rampart

Is your InventoryManager a Network Behavior on a Network Object?

tame rampart
#

i think so 💀

sharp axle
tame rampart
#

it's still complaining

#

it has to do with FindFirstObjectByType<InventoryManager>()? that's the line that is causing the exception

fringe imp
#

if i have interpolate turned on on networktransform should rigidbody component interpolate be off?

sharp axle
sharp axle
tame rampart
#

I guess it makes sense that networkobjects in the scene are also waiting to be spawned when I start host

#

how do I delay trying to set it until the object is spawned?

#

I am using the OnNetworkPostSpawn() function too

tame rampart
#

okay, I figured out a solution. not sure if its best practices but whatever

#

I basically check if the inventory is spawned yet. if it's not, then subscribe to an action delegate from inventory script that gets invoked when its networkobject is spawned

#

if it is already spawned, then just add it

#

for some reason, the host seems to always spawn the player first, and a client spawns the inventory manager first

#

not sure how unity works!

white meadow
#

there is any tutorial how to use unity3d 6 multiplayer center? Some examples how start with that (not just sample gameobject and scenes cuz only that i found), I focus on server hosted method :#

sharp axle
vivid zodiac
#

Is there any method like "OnSceneChange" for the NGO so when the scene changes i can get my custom network manager to check the name of that scene and if it matches just do what has to be done, i could very well put it in Update but it's not worth checking the scene name every frame

sharp axle
silent trellis
#

does netcode for entities support adding component at runtime? I read the documents are it seems like it, but I am not sure if I understand it correctly since adding component at runtime sounds like a feature that too important to be ignored

blissful jay
sharp axle
normal bluff
#
    public void SpawnUnitServerRpc(ServerRpcParams rpcParams = default)
    {
        // Instantiate and spawn the unit at random position
        Vector3 spawnPosition = new Vector3(Random.Range(-5f, 5f), 0, Random.Range(-5f, 5f)); 
        GameObject unit = Instantiate(unitPrefab, spawnPosition, Quaternion.identity);
        var instantiatedUnit = unit.GetComponent<NetworkObject>();
        instantiatedUnit.SpawnWithOwnership(OwnerClientId);

        // Add unit ID to GameManager's NetworkList
        GameManager.instance.AddUnitServerRpc(instantiatedUnit.NetworkObjectId);
    }

Hello. I am having a little difficulty working on the logic for something I want to do. Above is the code I have but I don't think it does what I want.

I want to look at the unitPrefab on the PLAYER and instantiate that prefab. The instantiated unit should have all of the customization, abilities and choices that the player chose before the match started. I understand i will need to instantiate (or call an index#) for each of those customizations. What I dont get is, if the SERVER is calling this RPC, isnt the thing being spawned just the default prefab without the player's choices on it?

sharp axle
normal bluff
sharp axle
normal bluff
#

So the eaier way is to make the gear/clothes just be there to begin with it looks like. This is incredibly helpful thank you.

magic yarrow
#

Can someone help me to figure it out what am i doing wrong, when i`m Loading scene my host have an error that he has 2 audiolisteners, also client is controlling my host

tame slate
empty night
#

Can someone tell me why my host moves just fine but my client has slow jittery movement?

using UnityEngine;
using UnityEngine.InputSystem;
using Unity.Netcode;

public class PlayerMovementController : NetworkBehaviour
{
    [SerializeField] private float moveSpeed = 5f;
    [SerializeField] private float rotationSpeed = 720f; // Speed for rotating to face movement direction
    [SerializeField] private VariableJoystick virtualJoystick; // Reference to the joystick

    private PlayerInputActions controls;
    private Vector2 moveInput;

    private void Awake()
    {
        controls = new PlayerInputActions();
        controls.Player.Move.performed += ctx => moveInput = ctx.ReadValue<Vector2>();
        controls.Player.Move.canceled += ctx => moveInput = Vector2.zero;
    }

    private void OnEnable()
    {
        controls.Enable();
        virtualJoystick = FindAnyObjectByType<VariableJoystick>();
    }

    private void OnDisable()
    {
        controls.Disable();
    }

    private void Update()
    {
        if (!IsOwner) return; // Ensure only the owning client can control movement

        Vector2 joystickInput = virtualJoystick.Direction; // Get joystick input
        Vector2 finalInput = moveInput + joystickInput; // Combine inputs
        MovePlayer(finalInput);
        RotatePlayer(finalInput);
    }

    private void MovePlayer(Vector2 input)
    {
        Vector3 move = new Vector3(input.x, 0, input.y) * (moveSpeed * Time.deltaTime);
        transform.Translate(move, Space.World);

        // Synchronize movement across the network
        MovePlayerServerRpc(transform.position);
    }

    private void RotatePlayer(Vector2 input)
    {
        if (input.sqrMagnitude > 0.01f) // Check if there's movement input
        {
            // Calculate the direction to face
            Vector3 targetDirection = new Vector3(input.x, 0, input.y);
            Quaternion targetRotation = Quaternion.LookRotation(targetDirection);

            // Smoothly rotate to face the target direction
            transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, rotationSpeed * Time.deltaTime);

            // Synchronize rotation across the network
            RotatePlayerServerRpc(transform.rotation);
        }
    }

    [ServerRpc]
    private void MovePlayerServerRpc(Vector3 position)
    {
        MovePlayerClientRpc(position);
    }

    [ClientRpc]
    private void MovePlayerClientRpc(Vector3 position)
    {
        if (IsOwner) return; // Skip for the owner to avoid redundant updates
        transform.position = position;
    }

    [ServerRpc]
    private void RotatePlayerServerRpc(Quaternion rotation)
    {
        RotatePlayerClientRpc(rotation);
    }

    [ClientRpc]
    private void RotatePlayerClientRpc(Quaternion rotation)
    {
        if (IsOwner) return; // Skip for the owner to avoid redundant updates
        transform.rotation = rotation;
    }
}
tame slate
empty night
#

I changed authority mode on the player prefabs network transform from server to owner.

#

Now host and client move properly

sharp axle
#

If you are using Network Transform then be sure to remove those RPCs.

empty night
sharp axle
empty night
#

I took a year off c# and jumped into python , trying to re-review and get back into networking altogether

mossy wing
#

How do I fix "Internal build system error. read the full binlog without getting a BuildFinishedMessage, while the backend process is still running"?

fluid walrus
mossy bluff
#

hi guys im having trouble setting permissions on a NetworkVariable, does anyone have an example, im trying to sync a vector3

#

reverted to my old code that works but im trying to sync 2 mouse pointers only one of them works

winter peak
#

its any way to access network prefabs in ngo?

#

not spawned but registered ones

winter peak
#

or itself someone has some any good solution for spawning for example Tree thru static methods like some system soo I dont need to access like list of all networked prefabs but just do Like SpawnableObject.Spawn(ObjectType.Tree) which will return NetworkObject

#

I think anyway I need to create own scriptable object for this

mossy bluff
#

does a networktransform really od all the work without needing rpc?

#

been trying to sync to mouse pointers but spent along time with no success lol

#

one works the other just randomly jumps around

sharp axle
sharp axle
mossy bluff
#

thanks!, would be awesome but i cant get it to work

#

does it work with a child being the network transform, and its a rect transform

silent trellis
#

Has anyone tried Photon Quantum before? I heard that it is also ECS, and can write code just like a local game.Without cost consideration, would you guys recommend using DOTS+Netcode for entities, or using Photon Quantum?

#

For an autochess-like game

mossy bluff
#

seems like dots would be overkill

sharp axle
mossy bluff
#

yeh i think my problem was i was tryin to make a cross hair which needs a canvas

sharp axle
mossy bluff
#

i assumed netcode would be quite easy

#

which it seems so, just missing something

sharp axle
#

Networking is never easy

mossy bluff
#

yeh

#

im a network programmer lol

#

barely even connects have to keep restarting unity

sharp axle
#

But that said a 2d network object on a canvas will work

mossy bluff
#

yeh almost had it earlier but one was jumping around

#

may be unity bug

#

unity6*

#

oh seems to work after restarting!

#

so unreliable tho, nearly always wont connect

silent trellis
#

How many CCU does it support for each CPU core (assuming using the Unity Multiplay Hosting)? Supposed I am using netcode for entities, and a autochess-like game, where all entities in the match will be ghost, including bullets,etc.

mossy bluff
#

yeh i have to restart unity every single time to get one connect lol

#

works perfectly if i do that though 😄

sharp axle
sharp axle
mossy bluff
#

i dont see any

sharp axle
mossy bluff
#

suddenly seems more reliable

#

ah good thinking

#

hmm just says [Netcode] [Host-Side] Transport connection established with pending Client-1.

#

but i never see this when it fails-> [Netcode] [Server-Side] Pending Client-1 connection approved!

sharp axle
amber spire
#

What does this error mean?

I have a pizza level (picrel 2) with the following hierarchy (picrel 3) with a network object on a pizza prefab. Am I doing something wrong?

blissful jay
#

Photon Quantum is infinitely better than anything Unity has ever made

amber spire
mossy bluff
#

anyone know a quick and easy way to implement a lobby

winter peak
#

its possible to access ip address while doing approval check? also its any main reason why "Reason" in response is as string? unity ngo

mossy bluff
#

anyoneseen this error KeyNotFoundException: Specified number of players (2) not found in Remote Config player options.

#

trying the unity serverless lobby demo

sharp axle
mossy bluff
#

damn why does nothing ever work without a fight with unity

#

looks like a very cool sample though, does A LOT of the hardwork

sharp axle
mossy bluff
#

cheers, will check it out!

#

ah id not deployed the remote config, theres tons of new stuff in unity6 i have never seen

winter peak
mossy wing
#

Even though I already asked a similar question, how do I use unity as a webhost?

sharp axle
vivid zodiac
#

Hi! I have a question, im wondering for why this scene event isn't working? I just wanna say that i am pretty new to networking but gotta start somewhere, so if there is some very easy and obvious answer to why it isn't working then sorry for bothering lol, but been trying to debug it for the whole day, even asked chat gpt and still no answers.

void Start() 
{
    if (NetworkManager.Singleton != null && NetworkManager.Singleton.SceneManager != null)
    {
        NetworkManager.Singleton.SceneManager.OnSceneEvent += OnSceneChange;
    }
}

private void OnDisable()
{
    if (NetworkManager.Singleton != null)
    {
        NetworkManager.Singleton.SceneManager.OnSceneEvent -= OnSceneChange;
    }
}

private void OnSceneChange(SceneEvent sceneEvent)
{

    Debug.Log("Working1");

    if (NetworkManager.Singleton != null && NetworkManager.Singleton.SceneManager != null) 
    {
        if (sceneEvent.Scene.name == RoundSceneName)
        {
            Debug.Log("Working2");
        }
    }
}
sharp axle
ocean wadi
#

Hi so I am currently changing my single player game to multiplayer. I am testing the features by running a playtest and build on the same machine. This means that I should pretty much have 0 latency between the host and the client, but I was wondering is it normal to have very slight latency when doing this? When performing a high speed action such as dashing, I noticed there is a very slight delay between the client and the host. Additionally, there is also a very slight delay when spawning objects and stuff. Is a very slight delay normal when testing on the same machine or is there something wrong?

sharp axle
idle needle
#

Hi, is anyone aware if it's possible to create custom inherited RpcAttributes?
I'd like to have defined attributes for common usage patterns, eg [FXRpc] instead of [Rpc(SendTo.Everyone, Delivery = RpcDelivery.Unreliable)] - but doing eg public class FXRpcAttribute : RpcAttribute, doesn't seem to trigger the codegen to transform the method into an rpc call
Am I overlooking something while defining my attributes here, or is this not achievable with the way NfGO is structured?
edit: dug into the codegen source and yeah, looks like i'd have to modify com.unity.netcode.gameobjects//networkbehaviourilpp.cs, which isn't really ideal :\

amber spire
#

Is it possible to change ConnectionApprovalCallback while NetworkManager is already running a server/host?

normal bluff
#

I used to have something in my unity that let me fake four different instances of my game so i can test multiplayer. Once i pressed play the game would run in Unity and it would bring up 3 other windows with the game running different players and i could make on the host. I am desperately trying to find out what that was again. Anyone know?

#

For anyone wondering, I found it. Its not a github download like it was before when i first used it in experimental mode. In Unity 6 its caleld Multiplayer Play Mode

vivid zodiac
mossy bluff
#

still cant get 2 players showing up on each others screen using netcode

#

think i had nit then i moved to try make a lobby with their example and i dont know how again..

#

also the one that does work is so delayed even on localhost, id hate ot see it across a real network

#

theyve made the whole thing into a nightmare, might go back to pun

winter peak
#

Attempted to write without first calling TryBeginWrite()

#

soo I need to calculate size by using if(!writer.TryBeginWrite(sizeof(float) + sizeof(bool) + sizeof(i))) { throw new OverflowException("Not enough space in the buffer"); } yes?

fluid walrus
winter peak
#

Safe method checks size every write yes?

#

and writevalue is more performant while doing just trybeginwrite on start?

#

also what about reading?

#

if someone can tell if its correct way of reading/writing stuff

#

or I should just use serializevalue thing while its not that complex

fluid walrus
#

it's only a small bounds check per read/write to use the safe methods, so checking the bounds ahead of time is more valuable the more frequently you're doing those operations

winter peak
#

while using BufferSerializer.SerializeValue(ref something) I need to also check size?

fluid walrus
#

iirc those call the safe methods

winter peak
#

hmm accessing NetworkList in awake method and list is null hmm

#

like networkmanager in lists is null idk why

winter peak
#

its any proper way to make networklists? I mean I do have public NetworkList<byte> _syncEffectsIntensity = new NetworkList<byte>(); but while doing _syncEffectsIntensity.Add in Awake its throwing nullrefs
if (!CanClientWrite(m_NetworkManager.LocalClientId))

tame slate
#

and you should ideally be adding to them after the network starts, not before.

winter peak
#

soo if its player object then it should be fine in awake?

tame slate
winter peak
#

public override void OnNetworkSpawn() ?

tame slate
winter peak
#

NetworkObject.Spawn()

tame slate
#

Initialize in Awake

#

Add to in or after OnNetworkSpawn

winter peak
#

finally no error spam in console aa thanks

#

now one action after spawning player object results of unity editor just closing

#

just attached debugger into unity uh oh

fringe imp
#

How common is it if instead of spawning bullets, bullets are local, and if you hit someone you just inform client you hit them?

tame slate
fringe imp
#

i spawn projectile, assign force, and projectile detects hits. youre throwing cards at eachother. Not sure if i should take different approach

anyways thx for the help

spring marsh
#

hi, im trying to make a lobby broser with facepunch.steamworks, i have this function that creates a lobby with Gameid unique to the game name set with SetData:

    {
        Debug.Log("host");
        NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnectedCallback;
        NetworkManager.Singleton.OnClientDisconnectCallback += OnClientDisconnectCallback;
        NetworkManager.Singleton.OnServerStarted += OnServerStarted;

        NetworkManager.Singleton.StartHost();

        CurrentLobby = await SteamMatchmaking.CreateLobbyAsync((int)maxMembers);
        CurrentLobby.Value.SetData("game_id", "TOFLOATBOAT");
        CurrentLobby.Value.SetJoinable(true);
        CurrentLobby.Value.SetPublic();    
    } ```
then i have this next function that searches for that lobby using the same gameid:
```     public async Task<bool> RefreshLobbies(int maxResults = 5)
    {
        try
        {
            Lobbies.Clear();
        var findLobbiesQuery = new LobbyQuery();
        findLobbiesQuery.WithMaxResults(maxResults);
        findLobbiesQuery.WithKeyValue("game_id", "TOFLOATBOAT");
        var lobbies = await Task.Run(() => findLobbiesQuery.RequestAsync());
    

        
        if (lobbies != null)
        {
            for (int i = 0; i < lobbies.Length; i++)
                Lobbies.Add(lobbies[i]);
        }

        return true;
        }
        catch (System.Exception ex)
        {
            Debug.Log("Error fetching lobbies", this);
            Debug.LogException(ex, this);
            return false;
        }
    } ```

My steam app ID is set to 480, so when I remove the specific game ID filter in the refresh lobbies function I can see other developers lobbies, but when I do it with the game ID filter I can’t find anything even when hosting the same game on another computer, is this because I need to get my own steam app ID first?

Any help is appreciated!
sharp axle
sharp axle
normal bluff
#

I am getting an error trying to check lobby or player data. I know it takes a few seconds before the data exists but even with a null check, when i poll the lobby the data updates throw null. And it happens every poll no matter how long i wait. Any idea why?

#

Its happening in multiple palces but the most common is (currentLobby.Data.TryGetValue("MaxSize", out var maxSizeData))

tame slate
normal bluff
#

Do you have a good place to start with Lobby events? This lobbydata is really causing my headaches

#

Oh i think i see it. They're like normal events you can subscribe to. Thanks

tame slate
normal bluff
#

I dont see event documentation in that site but i may ahve missed it.

tame slate
normal bluff
#

await LobbyService.Instance.SubscribeToLobbyEventsAsync(currentLobby.Id, callbacks);

I cant tell if this is correct. I had to wing it. do you know?

tame slate
#

Yeah, that's correct

#

documentation can be found here

normal bluff
#

Wonderful thank you!

sharp axle
covert gull
#

For an indie game that has co-op multiplayer, is it better to provide a lobby list for players to choose from when looking for public games to join, or should I implement automatic matchmaking where you set some filters and automatically get put into the closest matching lobby?

#

I'm using steamworks. Currently I have a lobby list, but I'm starting to think automatic matchmaking might be better?

tame slate
covert gull
normal bluff
sharp axle
normal bluff
tame slate
#

along with Lobby

#

that migration guide tells you what you need to remove

normal bluff
#

Yea i didnt realize that at first. So i had rhem all installed LOL. all my references were bugging out

sharp axle
normal bluff
#

omg....

#

What are sessions?

#

This lobby thing is driving me NUTS

tame slate
normal bluff
#

oh man. I'll gladly start my front end of my game over and do this instead. Lobbies is driving me insane

#

you guys rock

tame slate
#

it just streamlines the linking of those packages together, doing a lot of the common things you have to do across those packages automatically or within a single call

tame slate
sharp axle
normal bluff
#

Im.... so effing glad i asked questions here first. This is a life saver.... thank you

#

is the widgets package i nthe package manager. I dont see it

tame slate
sharp axle
normal bluff
#

ah okay. I got it now. Im excited. I'll actually be able to get passed the lobby thing and go back to the fun stuff

sharp axle
#

They are excellent for getting up and started quickly, but they are not very customizable at the moment.

normal bluff
#

well this still will help a lot. i jsut need a lobby system so i can start testing with real people. and this was holding me abck big time

sharp axle
#

For quick and dirty testing just slap a Quick Join Session widget and go

sharp axle
normal bluff
normal bluff
#

I think ive got it. i jsut cant figure out how to access the data from playerpropertieschanged. Any idea?

sharp axle
winged ember
#

I am using Multiplayer Play Mode. Any time I do some code changes it says that the Network Configuration doesn't match, then I have to restart Unity and it starts working. Is there anything specific I have to do so I don't have to restart the editor?

normal bluff
normal bluff
sharp axle
fluid walrus
winged ember
#

Looked at my settings and it is set to reload by default, so it doesn't help. Unchecking and rechecking the other player did work

sharp axle
fluid walrus
#

i guess it's something to do with the asset database on the others not being told about changes, hopefully something they'll iron out over time

normal bluff
#

I finished writing the session/lobby code. Works great but im having one issue. When the host joins the player properties are added jsut fine. But when another player joins the player property PlayerReady doesnt seem to be getting added for that player. I can see it happening in the OnEnterSession method though

mint anvil
#

quick question if i pick up a gun, the weaponholder has to have a network object as well as the player itself (so two?)

normal bluff
#

the gun, the player (and unit if the player is jsut a camera controlling the unit i.e. a tactics game) has to have a networkobject component

mint anvil
#

yeah but i dont set the gun as a child of the player itself but to the weaponholder (hands) which are a child of the player

#

and this requires a network object ig

sharp axle
mint anvil
sharp axle
sharp axle
tame slate
mint anvil
sharp axle
mint anvil
#

RAAAAH

#

yeah idk how to solve this lol

mint anvil
sharp axle
mint anvil
#

(visible with yellow text in the animation)

tame slate
#

if they're seperate objects the animation shouldn't really me jammed together in to one file anyway

sharp axle
mint anvil
tame slate
mint anvil
#

i animate everything related to a weapon in the same animation controller, then at start slap it onto the player. this works perfectly, but with netcode apparently not because of parenting when spawning the weapon

mint anvil
tame slate
mint anvil
#

then it will work

#

and i am not planning to change them

#

so this system will work

#

i hate the approach of first person models/animations not being the same as third person ones, that's too much work and just dumb

sharp axle
mint anvil
#

notlikethis dies

mint anvil
#

yeah i dont see how that would help

mint anvil
#

what if i spawn an emtpy object with the script of the gun on the player, then spawn the gun model itself in the weaponholder with an rpc sendto.everyone?
btw, if i swap a weapon, can i just disable a network object in netcode or is that not possible (respawning would be dumb) or i disable the model and set a bool usable to false

sharp axle
mint anvil
sharp axle
#

Those Rpcs could be on the player instead. Leaving the weapon as a regular game object

mint anvil
winged ember
#

how do you organize code when you want to make local multiplayer and P2P multiplayer?
for example: player object that holds some properties and can spawn animals in the world.
edit: give me a an hour to actually figure out what my problem is 😅

tame slate
winged ember
#

so what makes my brain melt is that I can just use the direct object reference in local multiplayer, but in a networked version I don't know how I get the actual objects using the ClientID
also, how do you make both work? My current version was built for local multiplayer only
I think I have to create 2 player objects/prefabs one without a networkObjectComponent and one with it. For the networked version I then have to move the logic to a networkBehaviour and make it use the ClientID instead of the direct object reference. Then, depending on the play mode, I choose the prefab to use, right?

tame slate
#

The other benefit to what I suggested is that it allows you to connect a client to an online game with 2 players. So you're able to do fully local offline multiplayer with two players on one machine, as well as connect those two players to an online game.

winged ember
#

Is there an example of that somewhere? starting out with things and the light bulb is just starting to flicker (just yesterday I learned how to actually use the newtwork prefabs list and how to instantiate+spawn things)

tame slate
#

The main things to focus on are:

  • One object that represents the connection/machine. This object can be pretty barebones as it only has a couple responsibilities. Connecting/disconnecting, listening for input sources, requesting playable character objects to be spawned by the server when an input is found and storing these character objects.
  • Your actual playable character objects don't actually need too much special consideration. As long as you spawn them with ownership and correctly map an input source to them, they can handle pretty much all of their own networking logic themselves.
winged ember
#

Ok, now it really sounds easy. I guess I can google how to get object references with clientId
Thanks so far 🙇‍♂️

tame slate
#

If you spawn the connection/input manager object as a Player Object, you can get it via:
NetworkManager.Singleton.ConnectedClients[clientId].PlayerObject;

#

and then if you store reference to the playable character objects in a script on the connection/input manager, you'd also be able to access them with only clientId

normal bluff
normal bluff
normal bluff
#

Nvm. my logic was just bad. If this helps anyone, this is the working code:

normal bluff
#

How do i set the property of the session itself? I see ISession.Properties but i dont see any overloads

normal bluff
#

Brilliant! How did you figure that out so easily? Im looking at the page and i dont actually see that you have to use AsHost() first

sharp axle
#

lol, I'm a mod over on the Unity Netcode Server We've been digging through the docs for some time now.

normal bluff
#

Ah! okay that makes sense.lol

#
if (AuthenticationService.Instance.PlayerId == currentSession.Host)
{
    //host sets the session "SceneToLoad" property
    currentSession.AsHost().SetProperty("SceneToLoad", new("Battle"));
    await currentSession.RefreshAsync();
}```

This doesn't call UpdateSessionProperties for me. Im sure I did something wrong but i cant see what
#

I just debug.logged it and the property isnt getting set for some reason:

normal bluff
#

It should porbably be "SavePropertiesAsync()". I'll try that

#

Yea it was that. Thanks @sharp axle

split hedge
#

Why is this giving me an error?

sharp axle
split hedge
#

Nope, a button.

split hedge
#

oh wait no, this gives me the error when I try to create a new lobby

sharp axle
sharp axle
split hedge
tardy mist
#

does anyone know of a good networking solution that has steam integration and would work well with visual scripting? i've messed around with fishnet, but a lot of the actual networking from what i can tell can only be done in actual c#

mint anvil
sharp axle
mossy bluff
#

i have a networkvalue that i think its properly implemented, but it is always 2 out on the client.. its like the first 2 decrements dont work.

sharp axle
mossy bluff
#

thanks, yes i think it was just when i was printing them

#

thatsamazing, theyve made it easy, otherday i was confused by that lobby that as u said was over engineered, writing a simple one now.

mossy bluff
#

im trying to add something to a NetworkList but i get a null when i do, error copmes from inside NetworkList inside add, if (!CanClientWrite(m_NetworkManager.LocalClientId))

#

but the list is initialised already, any idea why its null there?

sharp axle
mossy bluff
#

Thanks a lot!

mint anvil
#

I can see myself getting client side prediction working somehow (I am using ngo not entities) but there is no host migration right? Idk if I heard it being in development ... or was I just dreaming

Anyway seems a bit complicated to me, but this feature feels like it makes paying for servers obsolete if the game is not in a huge scale

mossy bluff
#

i have a list of games like this, but for some reason the callback never gets updated when i update the list.. availableGames = new NetworkList<GameInfo>();
availableGames.OnListChanged += OnAvailableGamesChanged;

#

instead i have to call refresh every few secs, seems wasteful

mossy bluff
#

is there some bug doing something like this? think i saw on forum earlier public struct GameInfo : INetworkSerializable, IEquatable<GameInfo>

tame slate
mossy bluff
#

just once

tame slate
#

You can just assign the whole list to the NetworkVariable and then you have to call CheckDirtyState on it. I’ve seen people have more luck with this being reliable than NetworkList

mossy bluff
#

oh i mean ultimately id like many games in the list 🙂

tame slate
#

Yeah. You can still have that.

mossy bluff
#

ah nice,

#

i think im fundamentally confused how this works to be honest, kind of limped through it using copilot

tame slate
#
public NetworkVariable<List<GameInfo>> availableGames = new(new List<GameInfo>());

Should work for you

mossy bluff
#

will try it thanks!

tame slate
#

And then you just have to call availableGames.CheckDirtyState() and OnValueChanged should trigger for it

mossy bluff
#

so why doesnt networklist work do u think?

#

see all the stuff i did with the list then has errors like add etc

#

and dont want to change it all unless i know it would work

#

I`ll maybe come back to this, i should prob rewrite what i have

#

difficult to test without another ip lol

tame slate
mossy bluff
#

Yeh think i did read that somewhere

#

i think it started when i added name and desc to it

#

but that was hrs ago so not sure

split hedge
#

Hey, I get no error for this code, I just don't see the client's prefab on the host (and also it doesn't get moved)

mossy bluff
#

does anyone elses unity jerk a lot when testing 2 players? i know its a fast enough computer because sometimes it runs fine

#

is it listed in network prefabs?

#

and have a network obj script

#

im new to this so cant help much lol

severe abyss
#

Hi guys,
I am currently working on a multiplayer game and since yesterday or the day before I am getting this error message when a second player (client) joins my game session via the Lobby Service -> Relay Service...

I am using NGO 1.11.0, Relay 1.1.1, Lobby 1.2.2 and Unity 2022.3.50f.

0x00007ff7a7cf5a2a (Unity) DefaultBurstRuntimeLogCallback
0x00007ff7a73c59ca (Unity) BurstCompilerService_CUSTOM_RuntimeLog
0x00007ff8d4b25224 (0fe68df1e5ba95833e8f9a73948d692) Unity.Burst.BurstRuntime.RuntimeLog (at /Library/PackageCache/com.unity.burst@1.8.18/.Runtime/Library/PackageCache/com.unity.burst@1.8.18/Runtime/BurstRuntime.cs:137)
0x00007ff8d4b6643c (0fe68df1e5ba95833e8f9a73948d692) Unity.Networking.Transport.Relay.RelayNetworkProtocol.ProcessRelayData (at /Library/PackageCache/com.unity.burst@1.8.18/.Runtime/Library/PackageCache/com.unity.transport@1.5.0/Runtime/Relay/RelayNetworkProtocol.cs:498) AND :440
[...]```
I am getting the error on the server/host and client.

 I am not the only one with the error message: there is already a Unity community post: 
https://discussions.unity.com/t/received-an-invalid-relay-bind-received-message-wrong-length/1557791

Does someone know an answer for this issue?
split hedge
sharp axle
sharp axle
sharp axle
cloud vapor
#

guys Im kinda confused, do you use fishnet with heathen or fishysteamworks with heathen because I saw fishnet's website saying fishysteamworks is a wrapper thats compatible with heathen but arent they both wrappers? why would I use both

viral ether
#

sup gang, plz ping me for the reply c: ❤️

I have 50 cards for each of my players
when the deck initializes it takes from those cards and assign them as needed, the card image and such~

#

now, sometimes I will need to spawn new cards, how should I do this?

#

I could make the pool bigger, make it 100 card each card pool, but I think I rather have it spawn new card prefabs

#

something like this

split hedge
#

IsOwner prefisely

sharp axle
sharp axle
viral ether
#

later tho, today is the presentation XD :'v I'm so nervous, after today I will polish a lot of things and make the game better overall

#

so that's in the list now

sand talon
#

Hello!
I'm trying to get a little proof of concept for a game working, and i'm having some trouble with synchronization.
I'm using Photon Fusion 2 and the issue i am having is that if i quickly tap any directional key, the Direction value quickly switches back and forth between the previous, and target direction as if it can't decide which direction to apply. This only happens on Non-Host clients.
mu_playerDrawer class is only responsible for displaying the changes, and doesn't modify the networked values or calls any RPCs, so i hope it's not important in this issue.

winter peak
#

soo when I have network object which has network objects parented into that how I can spawn them also when spawning root

#

its any easy way via some setting?

#

these doors

winter peak
#

I cant have network objects already in prefab as parents?

#

seems like all these objects have same global id hash

#
Server spawns room

Room ( Prefab and NetworkObject )
- SomeObject
-- Door1 ( Prefab + Network Object )
winter peak
#

In this case I can just remove network objects on parent ones when root has one?

sharp axle
winter peak
#

hmm trying to connect to server but theres no reaction on other end

sharp axle
ocean wadi
#

Hi, so I am currently getting delayed spawning of objects between my host and client when they are running on the same local machine. The difference is spawning is noticable and longer than a frame. All my settings appears to be correct and should not be introducing any lag, I was wondering what some reasons for this latency could be? Could it have to do with differing framerate? I'm pretty new to networking so I feel like it is a very simple fix, but I don't really know what to be looking for.

tame slate
ocean wadi
sly lily
#

Hi, ive only used unity netcode to build my multiplayer games but i looked at photon and saw this. Does photon do all of this stuff by itself or is it like really easy to implement? Because in netcode you would have to do this all by yourself which would be very very hard. Like Client side prediction or lag compensation.

#

if it really that easy i might actually switch

tame slate
tame slate
#

There are also other considerations like when using Quantum, you are required to use their physics system and are unable to use Unity's physics.

sly lily
# tame slate "by itself" is a bit of a misnomer. They provide these features for you to work ...

yes, but how much time does that save you? I would say a lot. I dont even know how i would build Client side prediction or lag compensation from scratch in netcode and i didnt seem to find any useful tutorials on it either. And these things are practically necessary, i mean a game without client side prediction is basically unplayable and an FPS game without lag compensation is also unplayable.

#

if there was like an asset or something that would do this in netcode i wouldnt even think about switching

tame slate
#

Depending how how important pinpoint accuracy and anti-cheat is, you could make a respectable small-scale casual FPS experience in NGO using Client Anticipation and by implementing a basic Lag Compensation system which I would say is not too hard to do with NGO.

Client anticipation is only relevant for games using a client-server topology.

sly lily
#

Also my game could be client authoritative, which would delete the need for client prediction, but i would still have to make lag compensation

tame slate
sly lily
dry maple
#

Not sure what you mean actually

sly lily
#

and detailed documentation on how to implement it to your game

dry maple
#

No, you wouldn't implement it, you would use it. Your wording is confusing

sly lily
#

yeah thats what i meant

dry maple
#

And yea, they make it pretty easy to do CSP, and the rest.

dry maple
#

There are tons of games that do not do any of these

#

and they are playable

#

COD and BF don't even do lag compensation. They do a broad phase sanity check.

sly lily
#

if you had a server authoritative game you NEED to have client side prediction otherwise you would have huge delay on your own movement etc... and without lag compensation you wouldnt hit any target if it was moving and some speed.

sly lily
dry maple
dry maple
#

But yea, pure lag comp is a lot better. Because with this method, the devs usually do random things like artificially worsening the hit-reg of players with bad connections which is awful.

sly lily
dry maple
# sly lily so thats why there are so many cheaters in COD

No, two of the most important cheats are almost fully unpreventable: aimbots and wallhacks (seeing through walls).

There are ways to try to detect aimbots using Machine Learning, but it still flags good players as cheaters, it's not reliable. And people have already found ways to completely go around the kernel anti cheats, etc.

Going full server-auth will not eliminate these two types of hacks.

sly lily
#

and they also dont have client side prediction so the delay on your own input is just awful

dry maple
normal bluff
#

I've been away for a long time. In easing back into multiplayer im learning that you need to NetworkObject.spawn anything with a networkobject or your RPCs wont work. Is there a way to just have those objects in the scene already and assign ownership to the host? Spawning them destroys the object refereences

tame slate
#

I believe you have to have something checked on NetworkManager, maybe Scene Management, but I believe whatever it is is on by default.

normal bluff
tame slate
#

NetworkManager, not NetworkObject.

normal bluff
#

Oh ! Sorry let me check

sharp axle
normal bluff
#

Thanks guys

split hedge
#

Hey, how do I sync playerNames displayed with a TMPUGUI on the player's head? Also how do I sync material colors?

split hedge
tame slate
# split hedge NGO

NetworkVariables are a way of synchronizing properties between servers and clients in a persistent manner, unlike RPCs and custom messages, which are one-off, point-in-time communications that aren't shared with any clients not connected at the time of sending. NetworkVariables are session-mode agnostic and can be used with either a client-serve...

split hedge
tame slate
#

Well I would make one NetworkVariable that's in a script that is attached to the player prefab

#

and you have to use FixedString, not string

split hedge
#

Why's that?

split hedge
viral ether
#

sup gang c:

#

I have this script where I call SetPlayer

#

I have (2) PlayerHandlers btw

#

and this function, "SetPlayer does get called

#

I can confirm that cause I debugged and, you can see the "IsPlayerOwned" is been toggled on the correct player

#

HOWEVER! <=

#

it's only doing the other part, the serverrpc and such for the host

#

🤔 I guess it's cause I'm calling it too soon....

#

when it hasn't determined which player is which yet...

#

no clue.... 😦

ocean wadi
#

Hi! So I had a question regarding scene management. When I am transition from the starting scene to scene B, I just walk through a portal. After walking through the portal my game freezes for a bit, which will be fixed later and probably covered with a loading screen, but that is not the problem. The problem is that when the client or the host interact with the portal the host's game freezes and start transitioning to the next scene, but the client's game does not. AFTER the host's game has fully transitioned to the next scene, the client's game freezes and begins transitioning to the next scene. I was wondering if this is normal or if there is an easy way that I am missing to make it so that the host and client begin transition at somewhat similar times.

deep wasp
#

Hello guys, i need ur help !
I'm trying to make the player able to hold an item in hand.
As i'm using netcode, i can't parent the network pickable object.
So, how can I do ?
I was thinking about making two prefabs of the pickable object : one that is networked and one not. Is this the right way ? Any alternatives ?

split hedge
tame slate
deep wasp
deep wasp
split hedge
tame slate
#

and usually makes any animations/transitions of picking up/dropping/interacting seem a lot smoother

deep wasp
#

thanks for answering guys, appreciate it!

deep wasp
split hedge
#

No, don't do that imo

tame slate
#

You could also make a dynamic system that detects what mesh is being picked up at runtime

#

And then instantiates it locally on every client instead of doing it via NetworkObject.Spawn()

tame slate
#

The only real reason to do reparenting or joints is usually VR where you have to be able to swing the object around dynamically with your hands - “faking” it allows things to seem more responsive and lets you be more in control of the interactions

deep wasp
#

Thanks for answering man, i'll try!

ocean wadi
#

So I am working with syncing up dashing effects right now between the host and client in a peer to peer game. I am running two instances on the same machine so I'm pretty sure this much of a difference between the host and the client should not be happening. The two images below are of the client's player.

#

The image on the left is the client player on the host's screen, and the one on the right is the client player on the client's screen.

#

Pretty much how the effect is created is through my object pooling system, where if the client dashes, it requests for the object to be spawned and then synced using .Spawn on the server/host side.

tame slate
# ocean wadi So I am working with syncing up dashing effects right now between the host and c...

That's not a crazy amount of delay - even when testing on the same machine you're always going to see some delay.

I think you're going about syncing this effect in a way that's overly complicated. There's not much reason why this effect would requires the server to .Spawn NetworkObjects for this. I would look at simply using a NetworkVariable or an RPC to indicate to all clients that this player object is dashing. Once clients receive this update, they can locally instantiate the phantom clones of the player sprite to create the dashing effect. This will always result in the effect appearing right behind the dashing player.

split hedge
#

Hello, how do I use FixedStrings as strings in networkvariables?

sharp axle
# split hedge Hello, how do I use FixedStrings as strings in networkvariables?

NetworkVariables are a way of synchronizing properties between servers and clients in a persistent manner, unlike RPCs and custom messages, which are one-off, point-in-time communications that aren't shared with any clients not connected at the time of sending. NetworkVariables are session-mode agnostic and can be used with either a client-serve...

split hedge
#

Thanks

split hedge
#

How do I sync TMP texts? I want to display the playerName on the screen with TMP UGUIs

#

I tried ServerRpcs but those didnt work

wispy cosmos
#

Hi there, I'm following this official tutorial about netcode for entities in order to learn the basics of multiplayer (Unity 6): - https://docs.unity3d.com/Packages/com.unity.netcode@1.3/manual/networked-cube.html

I follow the steps, manage to create a local multiplayer game, when the ghost cubes are spawned accordingly to the number of players, but I can't manage to move the cubes by pressing the arrows (From CubeInputAuthoring#SampleCubeInput), despite being correctly added to the Cube prefab.

GhostAuthoringComponant (on the Cube prefab) is set to Owner Predicted and Dynamic, with Support Auto Command enabled.

Does someone knows why ? Thanks in advance

sharp axle
#

I'm following this official tutorial about netcode for entities

tawdry night
#

hey guys just a question here i am trying to make an inventory for multiplayer but i found out not all methods work as good what is a good method for the inventory and than i mean like setting the obj invisable or destroying the object or scriptable objects

finite stag
#

anyone know rollback netcode?

dry maple
finite stag
finite stag
#

@dry maple

sharp axle
split sonnet
#

Hello everyone, i have created a multiplayer chess game in unity, and for that i need timers, but the problem is each player in chess needs to have their own timer, and every time it's their turn their timer should start and the other players timer should stop, these times needs to be synched on both sides, how can i implement this using internet time or an NTP server or any other way ???

#

is anyone here created a turn based multiplayer game that needed timer? if so how did you manage to do that ???

split sonnet
sharp axle
split hedge
#

Hey, how do I enable clients to write into a networkvariable?
This approach doesn't work

fluid walrus
split hedge
#

I'm using playerName.Value in a simple function

split hedge
#

This particularly

tame slate
# split hedge

Do they own the NetworkObject that has the NetworkBehaviour with playerName in it?

split hedge
#

Those are scene objects

tame slate
split hedge
#

Yeah sure but whats the code behind the ownership?

tame slate
sharp axle
split hedge
ocean wadi
#

Hi! So I am currently converting my single player combat system into multiplayer. I am working on just syncing character stats such as max health right now. My stat system right now pretty much has a main character stat manager called CharacterStats which houses a bunch of Stat variables, which is a custom class that has a bunch of important methods such as GetBaseValue and AddModifiers. I would want to maintain this custom Stat class and modifier system, but how would I even start with converting this system to multiplayer? I was thinking of creating a custom NetworkStat script where the main value is a NetworkVariable, however, wouldn't this require it to inherit from NetworkBehavior and require an actual component rather than just data values like in my Stat class?

sharp axle
hasty sky
#

Could anyone please explain me where I am doing mistake?

sharp axle
#

Profiler help

scarlet hull
#

Heyy i wanted to make an online party game in which you could host a session and other people could join you via a session browser.

Is that doable with the unity networking for gameobjects? if so, how? i don't want to have to spend a lot of money on servers, most of it should be handled by the player hosting his own game.

If anyone could help me that would be awesome ❤️

viral ether
#

^ welp no clue, but I do have another question

#

I usually do ServerRpc > ClientRpc > Local function

#

I assume I don't need that third local function, I could put everything inside the ClientRpc. Is that correct?

sharp axle
sharp axle
viral ether
#

a... 💀 well thanks a lot XDDDDDDDDDDDDDDDDD

#

I... I guess for my next project, and coming functions for this one

#

thanks a lot

viral ether
#

sup gang (again)

#

I'm getting the debug from the server rpc, however on my client rpc, and local function~ those debug are not being casted

#

I don't see what I'm doing wrong 🤔

#

ah... I see

I did not have "Spawn with observers" toggled in my network object

#

sorry people xd

scarlet hull
sweet siren
#

Might be slightly unrelated but does anyone know the name of relay servers that hold the ip, port and name of servers for players to request a server list?

#

I heard the term master server but it seems like such a generic name that covers a lot of bases and nothing specific. I got a lot of things master server related

sharp axle
sweet siren
#

Honestly just decided to go with lobby there's no point in me even trying to make my own when something like lobby is so cheap

fringe imp
#

@sharp axle watched a vid this morning and couldnt fiugure out why the name rang a bell so much. https://youtu.be/9wNKZPoMWvw?si=aqa9K_qtfQ0SDGHN

With the release of Unity 6 behind us, let's dive deeper into the new multiplayer topology of Distributed Authority and what this means for the future of games.

Every month we host a game development related workshop online. So come hangout and meet other people in the local game development community!

Find us on Discord! https://discord.gg/Fu...

▶ Play video
#

great video (:

sharp axle
#

I'm gonna try to do some shorter videos on smaller topics like RPCs and Connection Events

dusky nacelle
#

Hello i am trying to make a grappling hook tag game with multiplayer but my players aren't moving every for themselves even when i used if (!IsOwner) return; and ClientNetworkTransform.cs script i checked the console but it didn't print out any errors and i checked a lot of videos webs but nothing so i am trying to find help here

sharp axle
dusky nacelle
#

yes

#

I have these errors but i dont think they are related to the problem because i have these since i added player movement

sharp axle
#

Hello i am trying to make a grappling hook tag game

azure solstice
#

I am using Relay/Lobby to create/connect to game for a two player game. I had someone reach out saying they couldn't connect to their spouse. Is this just an issue because they are on the same IP address? Or how does this work exactly?

sharp axle
azure solstice
sharp axle
azure solstice
sharp axle
azure solstice
#
private async Task<Lobby> QuickJoinOrCreateLobby()
{
    Lobby lobby = null;
    int attempts = 4; // Number of join attempts before creating a lobby
    
    for (int i = 0; i < attempts; i++)
    {
        lobby = await QuickJoinLobby();
        if (lobby != null) return lobby; // If found, return the joined lobby
        
        await Task.Delay(500); // Short delay before retrying
    }
    
    return await CreateLobby(); // If no lobby is found, create a new one
}

It may have just been luck. a 2 second window seems pretty tight here. Any suggestions on how this is normally handled? It tries 4 times, once every .5 seconds to join an existing lobby otherwise it creates one.

#

@sharp axle

sharp axle
azure solstice
sharp axle
ivory oasis
#

Is changing network variable write permissions after initialization supported? I changed a network variable's writing permission from server to owner, but I'm finding that the variable is no longer being synchronized over the network. Is there a way to restore synchronization or is this unintended behavior from changing permissions?

tame slate
ivory oasis
#

Essentially, I have a parent class whose network variables are set to server perms, but I want its child classes to let owners have permission.

#

Unity has a problem when I try to hide the members in the child classes, so I resorted to setting the perms manually in the start method

tame slate
ivory oasis
#

This is thrown when I try to set the permission to owner on initialization

#

Left is the parent class, right is the child class

tame slate
#

I was suggesting setting it in the parent class only

#

as Owner write perms

#

I don’t think Owner write perms precludes the server from writing to it. As long as the server owns the object.

ivory oasis
#

Thing is though, the permissions are working as expected; I tested that only owners can modify the values in the child class where the server can't, and vice versa. The only issue I see with this is that the values are not being synchronized between the server and client.

tame slate
ivory oasis
#

aiyah probably :(

#

Any workarounds you can suggest maybe?

#

Worst case scenario is that I just make two separate health systems for NPCs and players, but I'd like to have a unified system if I can

tame slate
#

I would just choose one set of write perms, declare it on the parents initialization only and set it accordingly.

sharp axle
#

just do it in the OnNetworkSpawn() and set it to whatever you need there

ivory oasis
#

I'll fiddle with these ideas, thanks for the help 😊

ivory oasis
#

Alright, so turns out the proper way to set network permissions of inherited network variables is through the Awake method, which I actually did do, but I made a logic error so I thought it was incorrect. 🤦‍♂️

#

Synchronization works and everything!

rare lava
#

Hey guys, wondering if anyone would have any idea of how to debug something like that.
I have a linux Unity running and webgl instance.
I'm using NGO with Unity Transport configured for wss.
It works well where there are not too many people. But after like 10/15 people, I get messages like:

"CompleteSend failed with the following error code: -5"
and
"Error sending message: Unable to queue packet in the transport. Likely caused by send queue size ('Max Send Queue Size') being too small."

They are flooding the logs. Doesn't seem to be any other error.
Soon, the players cannot connect anymore. And after a while, the server seems to shut down, for everyone.

I did update Unity Transport to the latest and tried to change some of the values but it doesn't seem to help 😦

Any ideas?

sharp axle
rare lava
# sharp axle You can increase the message queue size but you are likely just sending too much...

Thanks!
Could this be because I have too many users or could this be a very bad RPC that sends too much stuff ?
I just send basic data, like the player's position, and some RPC when they are interacting
But maybe 15/20 users is already too much for the server.
Is there a way to detect when this happens and to prevent it?
I did try to increase the message send queue size but yeah, doesn't fix the issue

sharp axle
rare lava
#

Thank you very much, I'll look that up

peak pulsar
#

Hey. I am trying to set the spawnpoint for my co op game (two players), but for some reason it only works about half of the time
I have the default positions in ApprovalCheck and no other place to change the default position
I always get the expected values from the spawnpoint and it seems to be setting it because the player spawns in the correct place, but then teleports to 0 0 0

sharp axle
peak pulsar
sharp axle
peak pulsar
#

2.11

#

Unity 6

#

This is my quick and dirty fix
It runs on the player prefab

#

(seems to be a bug where it runs host as well as client, but the hostSpawnpoint and clientSpawnpoint are working)

tame slate
peak pulsar
#

I meant there is a bug in my code, not anything to do with NGO

sharp axle
peak pulsar
#

It is set to server

#

nvm, its set to owner

#

was testing it a bit so I had it set to the wrong value

#

Checking like this fixed the bug with it running multiple times for the client, thanks

#

will test it a bit to see if it fixed the spawnpoints

#

nope, did not fix it, but at least now its only running once

tame slate
#

You're on NGO 2.1.1 so trying that in OnNetworkPostSpawn instead might work?

sharp axle
peak pulsar
#

doesnt seem like I have access to it

tame slate
#

I believe it's a protected method, not a public one.

peak pulsar
peak pulsar
#

OnNetworkPostSpawn did not fix it unfortunatly

tame slate
#

That leads me to believe you got something else going on on your end, either in the set up of your components or in your code. Position being set in Post Spawn should not be being overwritten by anything on NGOs end.

#

Does your movement code for the players work properly?

sharp axle
#

Definitely something else going on there. That code will work

peak pulsar
#

my movement code is very simple

#

I can try disabling scripts on my player prefab

#

got it to work 5 times in row when I disabled my scripts, seems like something I doing wrong

tame slate
#

I believe you should also be using .Teleport on the NetworkTransform instead of setting the position on the transform directly. Setting it directly will be subject to interpolation. But that's probably unrelated to your current issue.

sharp axle
#

make sure to disable the character controller on the remote players. it will override the network transform

peak pulsar
#

ok, will try both

peak pulsar
tame slate
#

You call teleport on the authority

#

which is determined by what you have it set to on the Component

#

I belive you said it's Owner

peak pulsar
#

yes, it is owner

#

So kind of like this?

#

or am I misunderstanding something?

#

Still getting the error even thought the player is the owner :/

#

I got it to work by only enabling charactercontroller and movement script for the playing player
Thanks for the help 😊

viral ether
#

hello gang

#

the rpc send to everyone

#

requires ownership?

#

like I did in the function below

tame slate
#

I'm pretty sure it's false by default when you use the new attributes

viral ether
#

oh cool

#

and is it the same as it was 🤔

#

one second let me get those professional graphics to explain myself

#

with Server > Client > Local function rpcs

#

no matter who called the function, it would be... casted by the server/host player

#

is it still the same with the new attributes?

#

or now, if I put "GetCurrentPlayerData" inside of it, it would get each player's data

#

if I misexplained myself, excuses. I'm tired and braindead at this point

tame slate
#

Client to client RPCs are possible with the new system, but as mentioned above this isn't an underlying change as the RPC still has to go to the server in the middle of this process.

viral ether
#

oh cool! ❤️

#

thanks for answering :3

#

"meow" and "uwu" type thing

wispy isle
#

So, I’ve run into an odd issue. I wrote a little networking prototype, it was working flawlessly, but suddenly clients can no longer connect. The console says the connection is going through but the screen stays black and no player spawns. Hosts client works fine, but no other clients will spawn.

I’ve tried starting my computer, double checked network manager. Again no changes were made literally just stopped. Any suggestions or thoughts on what I can try?

sharp axle
wispy isle
edgy tiger
#

Hi, I've got a strange issue with my game, where when the players spawn in, the host spawns in the correct position, whereas the client moves to 0,0,0. The player objects work by using a sphere to calculate physics, and the player model is teleported there. The sphere is deparented on start, and has a network rigidbody and client network transform. This happens inconsistently, and doesn't happen when i disable the rigidbody on the sphere. Does anyone have any ideas of what this could be?

sharp axle
sharp axle
edgy tiger
#

OnNetworkSpawn i spawn it on the host then set the owner to the correct clientId

#

The thing is, i know it spawns in the correct position because at first, i stop the player from moving until the countdown ends

#

As soon as it can move, it does it

#

Is there any way i can fix the interpolation? It seems to work when i turn it off but its really jittery

tame slate
edgy tiger
#

I apply forces to the sphere and the player model sets it's position to the spheres position

#

The sphere's the only one with a rigidbody

tame slate
#

If you want an instant change in position, you should use NetworkTransform.Teleport as opposed to setting the position of the transform directly.

#

Teleport isn't subject to interpolation, even when interpolation is on.

edgy tiger
#

Ah okay ill change that

white meadow
#

hi, where I can find any tutorial on new unity3d multiplayer center (so also networking in that, how works, create lobby etc. not just using scenes that unity have for multiplayer - wanna understand how it works)

sharp axle
white meadow
sharp axle
mossy wing
#

I know this isn't related to unity but how do I use a DNS as a website URL?

sharp axle
mossy wing
#

Never mind, I figured it out.

magic yarrow
#

Can someone explain me, why only my host can grab and change position of object, when im trying to grab something on client its not working

hearty dock
wild turtle
#

do you guys know where I can get started with Unity 6 networking, especially for using Steam?

sharp axle
# wild turtle do you guys know where I can get started with Unity 6 networking, especially for...

For Unity Netcode for Game objects. Follow the quick start guide and read through the docs
https://docs-multiplayer.unity3d.com/netcode/current/tutorials/get-started-ngo/

Use this guide to learn how to create your first client-server Netcode for GameObjects project. It walks you through creating a simple Hello World project that implements the basic features of Netcode for GameObjects.

left kelp
#

My network rigidbody doesn't appear to be affected by gravity, and I can't figure out how to actually move it. If I try moving the real rigidbody it doesn't work, and even though gravity is checked it doesn't appear to have gravity.

sharp axle
# left kelp My network rigidbody doesn't appear to be affected by gravity, and I can't figur...

Network Rigidbody is kinematic on clients that are not the owner

There are many different ways to manage physics simulation in multiplayer games. Netcode for GameObjects (Netcode) has a built in approach which allows for server-authoritative physics where the physics simulation only runs on the server. To enable network physics, add a NetworkRigidbody component to your object.

left kelp
#

so I need to send movement to the server and have the server move things

sharp axle
faint plume
#

hello! has anyone tried using CreateOrJoinLobbyAsync ?

#

when i run it twice with the same parameters i get http error 409 on one of the instances, while i expected it to just join the lobby that the first call created

sharp axle
faint plume
#

Ah that's interesting

weak plinth
#

im trying to make multipalyer with photon and i need to put "if (view.IsMine)" some where so that the players dont meve each other does anyone know where to place this

haughty heart
#

Beginners shouldn't be taking on multiplayer, and people are not going to be super willing to help just knowing the amount of explanation they're going to have to do.

But an obvious place to put that code you think you need, would be in your Update function before you read the input for that character.

weak plinth
#

can u update it?

haughty heart
#

No

weak plinth
#

why

haughty heart
weak plinth
#

its just a game for my friends and i

#

please

tame slate
weak plinth
#

but i realy dont get it

tame slate
weak plinth
#

whyyyyyyyyyyyy

tame slate
# weak plinth whyyyyyyyyyyyy

Go download a sample project if you just want it done for you. I have no interest in writing code for someone - especially someone who shows zero interest in attempting to experiment or learn about the topic.

weak plinth
tame slate
# weak plinth i have been trying for over 2 hours

Such is programming and game development.

You were already given the answer in a pretty clear explanation. If reading that answer really registers nothing for you, you need to take a step back and read/watch some more content about networking and/or Photon.

faint plume
faint plume
#

it looks like WrappedLobbyService already catches it, dunno if i can do that again

#

guess i can try

#

ok it did work, it says im already in a lobby

#

thats peculiar

sharp axle
faint plume
#

Unity.Services.Lobbies.LobbyServiceException: player is already a member of the lobby ---> Unity.Services.Lobbies.Http.HttpException`1[Unity.Services.Lobbies.Models.ErrorStatus]: (409) HTTP/1.1 409 Conflict

#

i gotta check if i set up unique player ids correctly i guess

#

i have other code which uses Create and Join separately which already works, so i figured that must be correct, i just figured the combined CreateOrJoin version looked neat

#

thanks for the help, now i have a lead at least

#

ok yeah both unity instances for some reason get the same player id, i dont think ive had this happen before

#

but that must be it then

#

so the Create & Join separate case that works is using Relay, otherwise its hard to see any difference

#

maybe the Relay allows me to use two players with the same PlayerId

#

its interesting that it allows the same playerid. i just found a case in the documentation saying i need to detect this when using ParrelSync and create different profile

#

anyway, progress!

sharp axle
faint plume
#

yep, all working now!

#

thanks a bunch

#

still a mystery why the old code worked despite being the same playerid

junior sapphire
#

I’m using a linux server and a webgl client with NGO. Just started getting issues where the web client can’t connect to the game (websocket failure) but a unity editor client connects fine. Is it possible that too much network comms, RPCs, NetworkVariables etc could be preventing my browser build from connecting? Or perhaps memory usage is too high for the browser?

sharp axle
crisp gull
#

Can somebody clarify ownership when using network managers PlayerPrefab?

Say I have a player, they spawn and each is assigned a client ID. In the prefab there's child objects such as a light source, ect. Does each client own it's own child's?

Unity 6's visual tool shows that yes, they do but I feel like the server actually owns them..

Any clarification would be nice! What im after is having client authority on some child objects such as the light source

sharp axle
crisp gull
sharp axle
ocean wadi
#

If my understanding of networking is wrong please correct me during my explanation (new to networking). So I am running into an issue in another script called WeaponController, where I need to invoke server rpc (in order to handle attack collision detection purely on the server). In order to invoke a server rpc, I need to first call .Spawn on the object that wants to invoke the rpc, in this case it would be my sword object. The code above is located in my WeaponSwitching script and is in charge of handling the instantiation of the weapon. I am trying to reparent the weapon as a child of the player, however, for some reason the weapon is not being reparented. I pretty much had 2 questions. Is it true that when dealing with nested network objects, you should initially spawn in the child network object as it's own parent and then reparent it manually, as you can run into issues if you directly instantiate a network object as a child of another network object? Additionally, is there a better way than what I am doing right now (I feel like there is a very easy solution that I am missing here)?

sharp axle
ocean wadi
sharp axle
ocean wadi
sharp axle
# ocean wadi I think I found the issue. Would it be because I am trying to parent the weapon ...

Yea that would be a problem as well. Network Objects can only be a child of another network object
https://docs-multiplayer.unity3d.com/netcode/current/advanced-topics/networkobject-parenting/

A NetworkObject parenting solution within Netcode for GameObjects (Netcode) to help developers with synchronizing transform parent-child relationships of NetworkObject components.

ocean wadi
# sharp axle Yea that would be a problem as well. Network Objects can only be a child of anot...

Ahhh I see I see. You mentioned earlier that there are other ways of attaching objects to the player. I was wondering what common industry practices are for this? Would one way just be to manually update the position of the weapon to follow an anchor point? Would it be easier to just change up my player hiearchy so that the weapon is a direct child of the player (the only point of the WeaponHolder child of the player is really for organization but if I wanted I could pretty easily have the weapon as a direct child)?

fringe imp
#

just not other way around

ocean wadi
fringe imp
ocean wadi
# fringe imp ahh i see. Try making weaponholder a network object, that has a variable for the...

I have a script on the weapon that requires RPC calls, specifically for making sure when a collision is detected on the weapon the logic following such as calling damage functions occurs on the server rather than the client. If I'm not mistaken, an object has to be a network object and spawned in order to invoke RPC calls. Also I don't think I can make the weapon holder a network object as the player is spawned into the scene not already part of the scene.

fringe imp
# ocean wadi I have a script on the weapon that requires RPC calls, specifically for making s...

ah gotcha. So i usually do this. and this is just advice, im not an expert - Change your way of thinking from weapon holder, make it a weapon controller (networked). Have all of your weapon code on it, have your weapon visual as a child. When you spawn in, in awake or wherever you want just hide the weapon visual.

Separate the visuals. All of your code will still work even if you weapon was a blank space, or a unity cube. Need to change the visual for everyone? Send an rpc that you changed the visual.

ocean wadi
fringe imp
#

just with visual hidden

ocean wadi
#

Wouldn't we run into the same problem of nested network objects though if controller is a child of player and both of which are network objects (since my player is spawned in and not a scene object)?

sharp axle
tame slate
#

I believe it's also built in that you can use a struct of primitive types to group things

sweet siren
#

I've seen people talking about host migration for NGO but I cant seem to find it on the docs or anywhere (I'm only seeing peoples' custom made host migration solutions). Can I get a link please?

#

Also any talk about experience with host migration would be awesome with stuff like how seamless the transition is or if there's any difficulties

sharp axle
sweet siren
#

Oh right...

#

Thanks for the link though lol. I guess it's just not quite what I need

fleet ice
#

hey guys in debug code ends in yield return www.SendWebRequest(); and i am not getting any debug log after this the payload i am getting is working on postman though.

#

this is where i am calling coroutine

knotty harness
#

has anyone managed to run the NGO+Multiplayer Widgets sample on a WebGL build with Relay? It's basically the most minimal test of NGO with Sessions (Lobby) running.

I'm trying in Unity 6, and a weird aspect is that it technically works as long as I create the session in the Editor and join it with the build (even if the "Joining Session..." log is never followed by the "Joined Session: <id>" log). I can move one player in each instance.

Buuut, I would need for the Create Session button to work in the build as well. There is no error to speak of, it just never ends Joining appropriately, so it never gives a Join Code to copy.

Otherwise, affirmation from anyone that has managed to run the Sessions with WebGL Relay in any of their projects would be nice to see, as I have not found any sample online that gives me any reassurance :/ .

sharp axle
knotty harness
# sharp axle I've run it with Distributed Authority and Webgl.

nice! that needs a dedicated server however, I'm aiming to have some "serverless" games running with Relay.

My suspicion right now is that the async await that the template uses on the EnterSession function just never finishes on browsers. are you yourself using the SessionManager.cs that comes with the template or you tweaked it?

#

alright, I confirmed that suspicion with a minimalistic test that I saw on this thread:

https://discussions.unity.com/t/async-await-and-webgl-builds/665972/70

Task and await just does not work on browser :/. the issue is a Unity bug and does not have to do with Networking so I'll stop asking in this channel. Thank you for the quick reply @sharp axle !

sharp axle
knotty harness
sharp axle
#

oh for DA, I did have to manually change the transport to Distributed Authority Transport

knotty harness
#

ok thank you I will test doing that and see

knotty harness
#

cool! its nice to see I can choose DA and it gets to the same point of functionality but I'm seeing the same exact issue.

However if it works for you without changing any code then maybe it has to do with my browsers in particular or some setting, and I don't need to change the Tasks code.

white meadow
#

any example for project structure and networking? I mean I have offline game, wanna change it to multiplayer + add gamemode mechanism (timers, points). it's kinda fps, I wanna make it hosted by player

sharp axle
# white meadow any example for project structure and networking? I mean I have offline game, wa...

For NGO, you can check out the Bitesize samples Or Boss Room if you want to see a larger architecture

The Bitesize Samples repository provides a series of sample code as modules to use in your games and better understand Netcode for GameObjects (Netcode).

Learn more about installing and running the Boss Room game sample.

tawdry night
#

hey people just a small question how do i make it a object is invisable for all players when something happens?

tame slate
tawdry night
tame slate
sweet siren
#

Is there a way to put NGO in some sort of stasis? When the host disconnects I don't want NGO to do anything about it unless I tell it to

#

The idea is I want the person behind the host to host a server but since absolutely nothing is gonna change I wanted them to host with an identical scene and then others can join but I guess it wont be as simple as that

#

If I cant find a way I guess I'll just make my own stuff with LiteNetLib or something. Having to pause the flow because one person left is annoying and really ruins immersion. With LiteNetLib I can probably just treat the next host as the host and that's it

tame slate
sweet siren
#

I mean it seems like it would be so long as your codebase is versatile enough but what I'm describing would probably require a direct connection between all players

#

I was thinking the host was the only one clients would listen to and so the clients could switch who the host was relatively easily so long as the new host actually acts like a host

#

GTA pulls off something similar afaik but it's also why they had huge issues with security

sharp axle
tame slate
#

When a host disconnect occurs you are asking all of the remaining clients to cobble together and agree upon what the state of the network and game should be. This is not simple as at any given moment in time, clients x, y and z will all have slightly different network and game states.

sweet siren
#

What if there isn't any critical info? It's meant to be p2p so my plan was all clients had a list of all players in the session ordered from first to join to last and whenever the host was unresponsive or something went wrong they switched to the next person in line

tame slate
#

That being said, that's still going to require a good amount of work to implement.

tame slate
sweet siren
#

Distributed authority isn't quite what I want from what I understand but I guess yeah I might have to accept host disconnects sometimes. Unfortunately I'm not old enough to have a job yet so I cant really support dedicated servers or distributed authority money-wise so p2p with lobby has been my go-to for a bit

#

As annoying as it is to have abrupt host disconnects friend groups are the target so my options are probably let people host their own dedicated servers outside of the game or the friend group will probably collectively agree on a time to get off the game so it's probably less disruptive than I'm thinking

tame slate
#

and unless I'm missing something about your game and setup, it achieves pretty much exactly what you're wanting.

sweet siren
#

Yeah sorry I skimmed over distributed authority last time but I just gave it a thorough read and it does do pretty much what I want

#

I'll look into it I suppose. As counter-intuitive as it is I've always opted in for safety when it came to subscription based services like DA or Unity's other services despite the fact I really doubt I'll be reaching 100s of players. Maybe it's time to just use common sense and go for it

fringe imp
#

morning! I currently use relay with join code to join two players, im looking to be able to start game, click 1v1 quick join, and anyone else who clicks that gets matched.

Do i need to look into lobby stuff for this or can it be simpler?

fringe imp
severe spear
#

hi, im using a docker container to host a linux server build of my game using nfgo and unity transport

#

for some reason, i can only connect with web sockets enabled

#

if web sockets arent enabled on unity transport then it just doesnt connect

#

however, if i use the windows server build outside of docker, it does work

#

ive tried every combination of ip and docker network i can think of

#

tcp connections pass through when i test with powershell

#

so ive sorta ruled out docker as the source of the problem

white meadow
#

which lib is most low cost(where 1 player is host and others just join lobby and play) + quick game option to just join random to lobby and start when there is X players?

fringe imp
#

GetNetworkObject(OwnerClientId);

is this right? Or is netowrkid different from client id

sharp axle
sharp axle
fringe imp
#

like if i said

Playerhealth health = Getnetworkobject(ownerclientid).getcomponent<PlayerHealth>();```
Is that correctly getting the client id or is networkid i seperate thing?
sharp axle
knotty harness
# knotty harness has anyone managed to run the NGO+Multiplayer Widgets sample on a WebGL build wi...

for anyone that finds themselves in my situation in the future, where Creating a Session does not return a code, or Threading tasks in general don't return a callback in a WebGL build, the way I got it solved for myself was just by installing this package from git, changing no code otherwise:

https://github.com/RageAgainstThePixel/com.utilities.async

If that's not enough for your issue, you might want to instead try this other one (altho for me in Unity 6, I could never make the WebGL build work with it):
https://github.com/VolodymyrBS/WebGLThreadingPatcher

maiden saffron
#

I just discovered this myself and came here looking for confirmation. Have Unity acknowledged that addressable do not work with NetCode and have a timeline when they will support? I cannot express how frustrated I am with Unity as literally any other multiplayer tool works with Addressables. Please tell me I am wrong and all I have to do is x or y.

sharp axle
maiden saffron
#

Found it

#

I am not overly familier with this side of Unity. Does this mean it is being worked on or is something I can try now?

sharp axle
maiden saffron
#

Does this mean we are waiting for a review before we can try?

sharp axle
maiden saffron
#

Thank you

sharp axle
#

Obviously make a backup before making any major changes

ocean wadi
#

I had a question regarding ownership. Would I want each respective player to own the weapons they pick up? I was just wondering what the common industry standard is when it comes to handling object ownership. (Planning on making my game a casual game so I don't really care too much about cheating)

sharp axle
ocean wadi
sharp axle
scenic trellis
#

Hey guys Im kind of new to unity and Im trying to figure out some netcode stuff. Do any of you know how IsServer could come back as false after running NetworkManager.Singleton.StartHost()

sharp axle
scenic trellis
#

What I'm trying to do currently involves, calling startHost() and switching to a different scene containing network objects. But these objects OnNetworkSpawn() events are not being called. Am I missing something here?

wide girder
#

Share !code correctly. This should be shared as a large code block.

raw stormBOT
oblique birch
#

idea is firstly selecting a unit, then clicking on a tile to create a temporary unit image, then if player clicks on that image, unit goes there
but the thing is, when clients click to units, nothing happens
it only works on the host
i am using unity netcode and unity transport

wide girder
oblique birch
#

i started client from unity editor, not host like i usually do

#

and i got

#

NotServerException: ConnectedClients should only be accessed on server.
Unity.Netcode.NetworkManager.get_ConnectedClients () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.9.1/Runtime/Core/NetworkManager.cs:186)
InGame.SelectUnit (Unit newUnit) (at Assets/Scripts/InGame.cs:129)
InGame.OnClick () (at Assets/Scripts/InGame.cs:34)
InGame.Update () (at Assets/Scripts/InGame.cs:19)
gentle minnow
#

Heya! I’m making my “copy” of CS:GO in Unity(2022 LTS), but can’t decide what Networking solution should I use. Can someone tell me what’ll be better to use? The game will have Matchmaking, Ranks, Lobbys and etc.
Currently I’m thinking of using FishNet with Steam.

sharp axle
oblique birch
#

I have this code, it is meant to make the movements and notify it to all clients. but it only works on client, other clients cannot see the changes

#

i got stucked really bad

#

need a hand

oblique birch
#

solved it nvm

sand talon
#

Hello! I'm using Photon Fusion 2 and i'm having trouble getting VR Synchronisation to work.
I have a head object, and 2 hand objects, being driven by Tracked Pose Drivers, and XRControllers, then synchronized by NetworkTransforms, but for some reason only the Host is able to move their objects, while the clients can't move them at all.
Could it be that the NetworkTransform does not respect the input authority, and only the StateAuthority?? If so, how would i go about changing that behavior?

weak ember
#

Hi, was wondering a good tutorial vid to start for making a multiplayer game in unity 6?

#

i plan on making a turn-based tactics online game with a handful of friends of mine so I imagine netcode requirements will be minimal

jade glacier
sand talon
#

:(

jade glacier
#

State vs Input authority is going to be very specific to Host vs Shared mode

jade glacier
#

I am one of the original devs of Fusion btw, and I started the discord servers for Photon

#

So I am not making that up LOL

sand talon
#

Oh!? Cool! :D

jade glacier
#

Photon has two discord servers, public and circle

sand talon
#

Honor to talk!

sand talon
jade glacier
#

Circle is paid, the public is open to anyone though

sand talon
#

Ah! I see!

jade glacier
#

It might require a photon login to exist to validate you as a user is all

sand talon
#

So the one linked in the webpage is the circle one?

jade glacier
#

But that is free, just may need to have an account on the website

sand talon
#

Gotcha!

jade glacier
#

Not sure, I don't work for Photon now, but I would expect the link to the discord to be for the public

sand talon
#

Loading into it. Great

jade glacier
#

@vagrant garden not sure who to ping, but are there any obstacles currently involved in people joining the public discord?

vagrant garden
#

that looks like a discord problem and not a photon one

#

I'd just retry

#

Link to join the Photon discord is in the pinned messages here btw.

sharp axle
white meadow
#

anyone got any tutorial/examples of how to use [EOS] EpicOnlineServices in unity? I mean to create lobby and transport way?

weak ember
#

question and sorry if this sounds pretentious, is there a way of a free server for unity games with a small player count (like at most 5)?

tame slate
ocean wadi
#

Hi, so I was actually planning on switching to fishnet from NGO. I was just wondering what some peoples opinions were on it who have worked with it. Also I was wondering before making the swap, if anyone knew the licensing around it. Is it okay to use for a game that I am planning on publishing on steam, I know that the licensing around open source code programs can be tricky at times.

abstract copper
# ocean wadi Hi, so I was actually planning on switching to fishnet from NGO. I was just wond...

it has similar features to many other networking solutions, but the main difference is that it has support out of the box for client prediction if you have a server authoritative game, and, in my opinion, more quality of life features. Also, it wouldn't be too useful if you couldn't publish your game with it! It is fine to use both the free or pro versions for commercial projects. Everything third party library it uses has the MIT license, and it itself is free to use / modify / redistribute (as long as you don't have the paid version, obviously you can't distribute that) https://github.com/FirstGearGames/FishNet/blob/main/THIRD PARTY NOTICE.md

#

I think it is one of the better options for real-time games if you don't plan on writing your networking with something like LiteNetLib

#

although if you are switching from NGO just because the networking gets convoluted, that is not something you can escape from with most of the Unity-specific networking frameworks (at least all the ones I have tried in the past). They will all have the same issues (one-size-fits-all style) since they can't cater to your specific game

blissful jay
blissful jay
#

which is very useful for coop or indie games

#

fishnet does not, neither mirror

blissful jay
#

fishnet is not open source too