Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

876
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!