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
1
Question by Chikari · Feb 07, 2017 at 05:38 PM · networkingprefablobby

"GameObject Player is a prefab, it can't be spawned. This will cause errors in builds."

I have a LobbyNetworkManager and a player prefab that I have dropped in the, well, "Game Player Prefab" field. Now the following error occurs: "GameObject Player is a prefab, it can't be spawned. This will cause errors in builds." - and indeed, the player crashes upon game start while in build.

What is the correct way to spawn a game player using LobbyNetworkManager, if not with a prefab? I am using Unity 5.6.0b6.

Comment
Add comment · Show 2
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 Salmjak · Feb 07, 2017 at 05:46 PM 0
Share

Does it have a NetworkIdentity-component?

avatar image Chikari · Feb 07, 2017 at 05:50 PM 0
Share

Yes, NetworkIdentity is attached (set to Local Authority) and Inspector allows dropping the prefab in.

8 Replies

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

Answer by Heremeus · May 25, 2017 at 02:53 PM

Removing the Network Identity (and all components depending on it) and adding it again fixed the issue for me. I have a prefab that is instantiated in OnServerStart and spawned with NetworkServer.Spawn afterwards that was resulting in the error somehow.

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 diego200052 · Sep 30, 2017 at 08:09 PM 0
Share

For me this works thanks :)

avatar image
5

Answer by tomfurrier · Apr 14, 2017 at 03:30 PM

It's intentional based on this post, and you have to instantiate the prefab first, then spawn the instantiated gameobject.

https://forum.unity3d.com/threads/5-6-unet-prefab-linked-gameobjects-within-the-scene.464178/#post-3028689

Comment
Add comment · Show 2 · 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 pappaxray2 · Apr 14, 2017 at 04:02 PM 0
Share

$$anonymous$$y issue was, I managed to break the prefab somehow maybe either readding the NetworkIdentity or changing it from a 2D to 3D rigidbody. Removing all the components left a couple of blocks remaining in the prefab. I then diffed that with the original object and removed the extra bits and it started working again. I'm guessing when Chikari's changed the serialization method the broken bits were lost in the conversion.

avatar image kaleidosgu · Dec 22, 2017 at 01:17 AM 0
Share

Thank you for your link. In the link, pappaxray2 gave a solution. You can change the gameobject's sceneid to zero(debug mod) then apply to prefab. The problem will be fixed. It caused apply prefab but there was some data in the scene file.

avatar image
2

Answer by zeetu · Jul 03, 2017 at 04:08 PM

I was able to fix this error on 5.6.0f3 by resetting the NetworkIdenity Component (no need to remove and re-add it.

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
avatar image
1

Answer by pappaxray2 · Apr 01, 2017 at 06:57 AM

There seems to be code to check for prefabs new in 5.6 which throws an error when a prefab is detected in NetworkServer.Spawn . Not sure why it is?

https://bitbucket.org/Unity-Technologies/networking/src/bfdfc58bb61bfdd7d49ceb8c69583482febadc84/Runtime/NetworkServer.cs?at=5.6&fileviewer=file-view-default

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
avatar image
1

Answer by mrbenn · Sep 01, 2017 at 10:27 AM

I found another solution to this avoiding the need to remove the NetworkIdentity component:

  1. Select the prefab

  2. Change the Inspector to Debug mode

  3. Locate the NetworkIdentity component

  4. Expand "Scene Id" and change "Value" to 0

I guess this does a similar thing to resetting it

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
  • 1
  • 2
  • ›

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

16 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

Related Questions

Player Prefab on Lobby Managers? 5 Answers

What can prevent a prefab network instantiation? 0 Answers

How to fix OnObjSpawn netId: 1 has invalid asset Id when using Lobby example in existing project 0 Answers

MLAPI error with two instances of networked object 0 Answers

Check if a player has Network View 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