Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by UDN_9a915d40-27e1-405b-b1cc-83be8be3e71d · Dec 26, 2017 at 06:57 PM · multiplayerunity 2dmultiplayer-networking

NetworkServer is not active. Cannot spawn objects without an active server.

Hi! I'm making a 2D Tank game where bullets are fired when you tap an on-screen button. The platform target is mobile.

I have Installed the app on my iPhone 7 and hosted a room. I then go in on the Unity connector and enter my phone's local ip address: 192.168.1.11. No errors and I connect successfully. Both the players are at the correct positions with the correct rotations etc... When I try firing a bullet from my iPhone (the host) it works perfectly without any errors but when I attempt firing a bullet from the client i get this error:

alt text

The error points to line 103 where: Network.Spawn(bullet_fired); Here's the relevant part of the script (Tank.cs):

 [Command]
     void CmdShootBullet() {
         if (!isLocalPlayer) {
         return;
         }
         Vector3 pos_offset = new Vector3(0, 0, -3f);
         Vector3 bullet_pos = bulletSpawn.transform.position - pos_offset;
         GameObject bullet_fired = (GameObject)Instantiate(bullet, bullet_pos, this.transform.rotation);
         
         // Physics2D.IgnoreCollision(bullet_fired.GetComponent<Collider2D>(), this.GetComponent<Collider2D>());
     //
         // Debug.Log("playerControllerId: " + playerControllerId);
         // if (playerControllerId == 0) {
     //         NetworkServer.SpawnWithClientAuthority(bullet_fired, connectionToClient);
     // } else if (playerControllerId > 0) {
     //     NetworkServer.SpawnWithClientAuthority(bullet_fired, connectionToServer);
         // }
         NetworkServer.Spawn(bullet_fired);
         // Destroy the bullet after 2 seconds
     Destroy(bullet_fired, 2.0f);
     }

Thanks for any help I can get! I have been debugging this for 2 days and scanned!

screen-shot-2017-12-26-at-171147.png (16.2 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

171 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can't work out multiplayer with Mirror 1 Answer

my friend can't join my multiplayer game! 0 Answers

How can I Instantiate only one GameObject Using PhotonNetwork. 0 Answers

Unity Photon how to show arm/gun movement with mouse to other players.,Unity Photon: How to show arm movement to other players 1 Answer

Can't connect UNet server, it just timed out 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges