I’m new to multiplayer networking. I’m creating an app that allows it’s users to load their own custom CAD model at runtime (mainly stp files) and sharing it on a network to collaborate upon. Currently I’m having issues on how to get the client to see the model. Because the models are being built at runtime they can’t be prefabs from the start. I’m not sure how to force a gameobject to the network manager so the client can see it. I thought that if I have a prefab parent, then load the model and make it the child of the prefab parent, then spawn it that would work but no luck. Like I said I’m new, I might be missing something obvious but any help would be appreciated. I’m using Unity 2022.3.10f1, NetCode 1.6.0, Multiplayer Tools 2.0.0-pre.5 if that helps any.
You can’t. It’s not the responsibility of (realtime) networking frameworks to transfer files to other clients.
While you could send a byte[ ] of the file, you’d have to do so in small chunks, waiting for a response, then send another chunk - and program that into server and client. A chunk max size depends on the networking framework, last time I tested with NGO 1.0 it was close to 30k and I believe it’s currently closer to 60k but not going to go above that. I once made an example implementation for Netcode 1.1.
Ideally you share the file through other means, for example by uploading it to a server or cloud storage, and then send a link to other clients so that they can download the file and apply it themselves.