• 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 NanoEngine · Mar 23, 2017 at 05:08 PM · networkinginstantiatephotoninstantiate prefab

PhotonNetwork.Instantiate is not "buffered"

Hello, I'm currently creating simple multiplayer first person shooter using PhotonNetwork engine, but I got crushed into the problem.

The problem I have is this:

I spawn Player1 using Manager by (PhotonNetwork.Instantiate)

I spawn Player2 using Manager by (PhotonNetwork.Instantiate)

but the problem is player1 can see player2, but player2 cannot see player1. I figured it out that it's not "buffered" Is there a way to solve this problem?

Comment
Add comment · Show 10
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 ChristianSimon · Mar 28, 2017 at 08:21 AM 0
Share

Hi,

PhotonNetwork.Instatiate(...) is buffered, so there shouldn't be a problem with that. Do you use the group parameter of the function (the last one) with any value else than 0 in one of these cases? In this case you need to set sending and receiving enabled for all clients.

avatar image NanoEngine · Mar 29, 2017 at 07:02 PM 0
Share

$$anonymous$$y group parameter is "0" Here is my piece of code where I instantiate the object:

 player = (GameObject)PhotonNetwork.Instantiate("myPlayer", Vector3.zero, Quaternion.identity, 0);
avatar image NanoEngine · Mar 30, 2017 at 07:09 PM 0
Share

I thought I did solved the problem, but I didn't. I'm still having this problem. Please someone help me. The thing is whenever I try the photonnetwork.Instantiate in my "test project", and it worked. I think there is something with my script...

         player = (GameObject)PhotonNetwork.Instantiate("myPlayerClassInit", new Vector3(0, 10, 0), Quaternion.identity, 0);
         player.GetComponent<LobbyPlayerSetup>().enabled = true;

This is litterly what I have in void Start() method... Please help me

avatar image ChristianSimon · Apr 03, 2017 at 08:41 AM 0
Share

You can try moving the Instantiation call from the Start() function to a OnJoinedRoom() callback. This makes sure that the client has definitely joined the room.

Can you tell us what happens in LobbyPlayerSetup script / component? I am also a bit confused about this name, because there are differences about the lobby and the room.

avatar image NanoEngine · Apr 04, 2017 at 03:20 PM 0
Share

Ok, in LobbyPlayerSetup, it's where I change the name of an object that I instantiated. I used simple GetComponent().RPC("ChangeName", PhotonTargets.AllBuffered, username); and there is no problem with it.

I'll explain you the scene. So basically, I''m trying to make a class selection scene. When ever the player gets into the room, I instantiate an object to the class selection scene, and in that object, there are some variables such as "current Class" or which $$anonymous$$m i'm belonging. And I made sure that instantiation call is called AFTER when player joined room. I checked using simple "ConnectionStateDetailed", and I even gave a little bit of delay using StartCorutine, and tried "OnJoinedRoom".

Show more comments

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

103 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

Related Questions

Photon Network Instantiate Objects over Network 1 Answer

[Photon] Looking for example code for late joining clients syncing instantiated game objects that don't exist in the base scene 0 Answers

Using RPC to Instantiate 1 Answer

How do I instantiate and set the parent of a Gameobject using Photon? 0 Answers

Photon Unity Networking - Player Camera Instantiate 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