When a client fires it spawns a number of prefabs which then kill themselves shortly afterwards. They contain a number of feedback mechanics including sound and particle effects, none of which need to be synced other than when/where the prefab is instantiated.
I’ve added these prefabs to the spawnable objects list and they work on the client’s side, but not on the server. (Or they work on the server but not on the client.)
I’ve messed around with Network Identities and so forth to no avail; what is the correct way of telling the server a prefab has been spawned, where it has been spawned and which direction it is facing?
(Much of my difficulty has come from building a game in JS and the few networking tutorials all seem to be in C#. My currently functional networking for player movement is all in C# and handled in different scripts. If possible, I would appreciate help understanding how to use UNET correctly in JS, although if anybody has a C# solution to my current problem which can run as a standalone script on the client-instantiated prefab, I will be elated. I have no experience with C#, but a solution is a solution.)
Your bullet prefab must have a NetworkIdentity component and it script should be like this:
public class bullet_script : NetworkBehaviour
{
[SyncVar] public Vector3 direction;
void Start()
{
// rotate your bullet
}
void Update()
{
// do your stuff
}
}