So I’ve started working with UNET to set up multiplayer in a project I’m playing around in and it works great EXCEPT for one thing: I don’t actually know how to properly instantiate a Rigidbody2D anymore and then get it to move…
Prior to UNET I would usually do something along the lines of:
void Update()
{
if (Input.GetButtonDown("Fire1"))
{
Rigidbody2D clone = Network.Instantiate(bullet, gun.transform.position, transform.rotation, 0) as Rigidbody2D;
clone.GetComponent<Rigidbody2D>().AddForce(transform.up * bulletSpeed);
}
}
This no longer works with UNET. I’ve tried using NetworkServer.Spawn(bullet) and I’ve registered the GameObject with the NetworkManager and this sorta works; however, this causes my bullets to sit idle after firing…
Suffice to say, UNET is awesome but not being able to find documentation on how to properly instantiate a Rigidbody and whatnot is kinda frustrating…
Any help would be awesome.