Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 KMKxJOEY1 · Mar 28, 2013 at 04:41 AM · instantiatenetworkspawnnetwork.instantiate

Network.Instantiate spawns multiple objects

It spawns as many as there are players connected

For instance, solo: works fine, 2 players: when I spawn something, 2 appear (one with an offset bc thy aren't right on top of the other)

I am spawning them in using reference object transforms on the player prefab, so I can only assume it is spawning relative to the other player too?

Thanks, Joey

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
0
Best Answer

Answer by KMKxJOEY1 · Apr 04, 2013 at 01:22 AM

fixed, i had multiple players in the scene, for testing. Even though they were disabled for the builds, the scripts were still running.

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
0

Answer by sasuke908 · Mar 28, 2013 at 07:47 AM

you might want to check that the person who instantiate the object is a server (as there is only 1 server in every multiplayer game (generally) only the server should instantiate an object)

if(Network.isServer){

 //code

}

to make sure only the server instantiates a network object. (or if you instantiate a lot you might want to create a static class to handle all instantiation so that it will work on both solo and multiplayer)

Comment
Add comment · Show 12 · 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 KMKxJOEY1 · Mar 28, 2013 at 11:34 AM 0
Share

Well the game is multiplayer only, by solo I meant testing in the editor

So a network.instantiate should only be called if you are the server?

If I am a client, then I have to send an RPC to the server to instantiate something?

avatar image KMKxJOEY1 · Mar 28, 2013 at 01:05 PM 0
Share

Ok ive gone and done that, now only the host can spawn things :( perhabs i am misunderstanding your suggestion.

avatar image sasuke908 · Mar 29, 2013 at 11:42 PM 0
Share

As long u use Network.Instantiate, very object should have the networkview component so every connected player should be able to see it :)

avatar image KMKxJOEY1 · Mar 30, 2013 at 12:33 PM 0
Share

I've gone and done that, no change :( also, i tried switching to a a normal instantiate just for testing, and it still spawned 2 objects, just only one client could see them

avatar image sasuke908 · Mar 31, 2013 at 02:32 PM 0
Share

you could paste your code here :D and i will see what i can do

Show more comments

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

11 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

Related Questions

Network.Instantiate players at each spawnpoint? Don't use the same spawnpoint? 1 Answer

Network.Instantiate Problem 1 Answer

Network.instantiate only works for Server to client 0 Answers

server and client sync 2 Answers

Network.Instantiate c# issues 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