#How to Add Network Identity to Dynamically Loaded FBX Assets for Host-Client Spawning in Unity

1 messages · Page 1 of 1 (latest)

vocal merlin
#

I'm developing a procedurally generated map system for my game using imported FBX models as room assets. These models are prepared at runtime so they can function as playable rooms. The goal is to eventually support user-generated custom rooms, so players can add their own rooms and play together, assuming both have the same files.

Since the game uses a client-host (peer-to-peer) model, how can I make sure these dynamically loaded room assets are properly , how can I assign a NetworkIdentity so the host can spawn them on both the server and the client?

loud latch
#

If players can import random FBX models, you need to network the data for these between all of the machines involved - then the server can spawn them. I'm not sure if you can just attach a NetworkIdentity to either side at runtime - but if these are just meshes, it may be easier to skip the NetworkIdentity and have the server send a message saying "spawn x mesh here".

jagged flint
#

Create an empty prefab with NetworkIdentity, MeshFilter and MeshRenderer (also MeshCollider if you need), and also add a custom script which has mesh datas as syncvar, then spawn it, set data on server-side , so clients can see the mesh.

#

and also, do not forget to add NetworkTransform (with server-client sync) if you need

jagged flint