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 /
avatar image
0
Question by Datapax · Jan 06, 2017 at 09:53 PM · networkingserverspawning problemsclient-serverhost

UNet NetworkServer.Spawn() not working / Failed to spawn server object, assetId=

Well, after some long hours I'm back here again with this creepy error.

As the title states - my "Network" is not working well. I have done everything obvious and I'm still getting this dirty error:

"Failed to spawn server object, assetId=48410ff8cf25a3646ba9e31b8553afcb netId=5"

I honestly recheck everything nearly 150 times and it is all good. NetworkManager has the Player prefab set, the "non-working" prefab is set in the NetworkManager Spawn Info unfold "Registered Spawnable Prefabs" This last one is also correctly set in the PrefabSpawner. Everything is just as it is indicated in here

All objects have correctly set up the NetworkIdentity - the PrefabSpawner has it set to "Server Only". All objects have NetworkTransform set also.

Everything is just set up fine but, still on the client node I receive this error once and over again.

It only happens on the client node, not on the host.

I'v already read like 4 dozens of topics, questions and answers, most of them having absolutely the same problem, some of them have solution - but unfortunately nothing worked for me : (

Also followed the Unity tutorials step by step. No way!!

Please help.

Spawner script:

 using UnityEngine;
 using UnityEngine.Networking;
 
 public class PlatformSpawner : NetworkBehaviour
 {
 
     public GameObject platformPref;
     public int numberOfPlatforms;
 
     public override void OnStartServer()
     {
         for (int i = 0; i < numberOfPlatforms; i++)
         {
             var spawnPosition = new Vector3(
                 0.0f,
                 i * 2,
                 0.0f);
 
             var spawnRotation = Quaternion.Euler(
                 0.0f,
                 0.0f,
                 0.0f);
 
             var platform = (GameObject)Instantiate(platformPref, spawnPosition, spawnRotation);
             NetworkServer.Spawn(platform);
         }
     }
 }

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

2 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by Datapax · Jan 06, 2017 at 11:42 PM

As I already saw in all cases, including this one, the problem can be due to many different causes.

In this case:::

I ended up switching the network manager Log Level to "Developer" and ran through all the logs there one by one. There I spotted a log, not an "error" nor a "warning" - just a simple log:

Multiple NetworkManagers detected in the scene. Only one NetworkManager can exist at a time. The duplicate NetworkManager will not be used. UnityEngine.Networking.NetworkManager:Awake()

Well, that was something! I had to pull my hairs off to find this "multiple" NetworkManager in my project. And just because it is NOT called a "NetworkManager" but a "LobbyManager" - however, this was the "nasty" problem causer.

I looked it all over, and of course, there it was, another "Registered Spawnable Prefabs" field, which logically was completely "empty".

Finally, just dragging up my prefab into the field was the solution to my headache.

So, if you are using the Unity Network Lobby and your project is using a separate UNet NetworkManager, AND you are having this same issue, make sure you register your prefabs on both "NetworkManagers".

I hope this helps others : ) Good luck and happy developing!

Unity 5.4.2f2

Comment
Add comment · Show 1 · Share
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
avatar image EuSuntNoob · Feb 16, 2019 at 08:36 PM 0
Share

thanks a lot for this but unfortunately I don't think this helps me. I have this problem: I made a different project for the client and a different one for the server, but when I connect as a client to the server, the Player Prefab GameObject from the Network$$anonymous$$anagerScript spawns on the server but it doesn't spawn on the client, it throws an error: "Failed to spawn server object, did you forget to add it to the Network$$anonymous$$anager? assetId=ca70e3141cc66db4c9d0bcf4b42a7854 netId=1" but I have the PlayerPrefab assigned in Network$$anonymous$$anager on both the server project, and the client project Thanks a lot for any response!!!

avatar image
0

Answer by TwinCrows · Dec 10, 2020 at 01:05 AM

For me, the problem was happening because the prefabs were being registered after the client attempted to load them. I was registering them, but just not early enough...

So I moved my ClientScene.RegisterPrefab(x) statements to an Awake() trigger and they spawned again perfectly :)

Like Datapax above suggested, changing the log level to Developer helped! You'll be able to see the exact order of events with the Network Manager.

Comment
Add comment · Share
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

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

86 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

Related Questions

Unity networking tutorial? 6 Answers

Qos type ReliableFragmented channel, won't fragment our stream 2 Answers

are client hosted servers limited by my 20 person ccu? 0 Answers

Creating non-player gameobject with Client authority 0 Answers

How can I transfer hosts once the current host leaves? 0 Answers


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