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 Narfi01 · Jan 18, 2014 at 02:37 AM · instantiatephoton

PhotonNetwork.InstantiateSceneObject works in editor but not in build

     if ((numberThatHaveSpawned < numberToSpawn) && (spawnToggleOnOff == 1) && PhotonNetwork.isMasterClient) {
                     PhotonNetwork.InstantiateSceneObject (whatToSpawn1.name, spawnPoint, Quaternion.identity, 0, null);
                     numberThatHaveSpawned ++;

             }

This runs just fine in the editor, and will spawn however many creatures I specify. However if I build the project and start the exe, then it does not. I have tested starting a built game, connecting with the editor, then connecting with another built game.

Since the first game started is the master client and is not the editor nothing is spawned, but if i exit out of that game and the editor (as the second to connect) becomes the master client then they are spawned and visible on both the editor and the 3rd game connected.

Obviously I don't want to have the editor be required to run as the master client, so how do I get things to instantiate properly in the built games?

Yes, the prefabs are in a Resources folder.

Comment
Add comment · Show 1
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 tobiass · Dec 02, 2014 at 09:13 AM 0
Share

Anything in the player logs? $$anonymous$$aybe the ti$$anonymous$$g is different. $$anonymous$$ake sure you are in a room before you call this.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by juippi112 · Sep 02, 2014 at 06:08 AM

That line can only be called by masterclient. And in the editor you are always the master but not in build. You should check if you aren't masterclient then send rpc to masterclient to instantiate sceneobject.

Maybe you already have figured this one out, but just to let everyone know.

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 Jeff00001 · Nov 30, 2014 at 04:09 PM

GameObject blabla = PhotonNetwork.InstantiateSceneObject ("PrefabName", transform.position, transform.rotation,0,null);

Attach script to gameObject spawn spot.

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

21 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

Related Questions

Photon Network Instantiate Objects over Network 1 Answer

Photon Unity Networking (instantiated object syncing) 0 Answers

Multiplayer game, object instantiated is being added for every single player 1 Answer

Photonview with 4 separate cameras 0 Answers

Photon- block instantiating problem 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