Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

878
Visualizações
Is it possible in Unity Mirror to connect and sync not spawned objects?

I have an object what I use only in one scene, so I do not want to make it prefab. This object has network identity, and a script which is increasing a syncvar integer in the update method. When the game starts this object got disable because the server is not running. When I start hosting the server this object got enabled. Everything fine is this point but when a client is joining this object is still disabled in the client and not synchronized.

If I am right it is because the objects are not connected to each other. how and I solve it without making this object a prefab and just spawn it?

How can I spawn objects without a player prefab with authority on the server (it would be a singleton service object)?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

NetworkIdentities have to be spawned. If it is already in your scene you can enforce it to be spawned by using

NetworkServer.SpawnObjects();

NetworkServer.SpawnObjects

Also you can spawn any prefab you defined in the NetworkManager. Look for the Registered Spawnable Prefabs Array. To spawn a registered prefab you can use

NetworkServer.Spawn();

NetworkServer.Spawn

For example spawn a registered prefab on the server using a Command:

[Command]
public void CmdSpawnGameObject()
{      
   var spawnObject = Instantiate(prefab, Vector3.zero, Quaternion.identity);
   NetworkServer.Spawn(spawnObject, connectionToClient);  
}

How can I spawn objects without a player prefab with authority on the server (it would be a singleton service object)?

You can't. You have to have a playerPrefab spawned and you have to have authority. But you can also hand over authority using

identity.AssignClientAuthority(conn);

Authority with Mirror

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda