Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 LightDrake · Jul 06, 2015 at 12:56 PM · scenephotonlevel

[Solved] Changing scenes on Photon

What I am trying to do is have two maps (say for instance a forest map and a house map), so two different levels in two different scenes.

So Scene A is the forest map, Scene B is the house map.

Everything works fine except when one player enters the house, he is still visible and moves on the forest map as well.

I've been looking a lot on google to solve this problem, even looked at demos, while on google the most common solution was to set "PhotonNetwork.automaticallySyncScene" to true; However this solution makes all players teleport inside the house map, and not just one player (the one that decides to enter it). In demos (the worker one), it uses two scenes but to switch between them, the player gets disconnected, since the use of the scenes is totally different than what i am trying to do.

So i've been trying different approaches on my own as well: The door is a trigger, the trigger contains a script, and within this script i have:

 void OnTriggerEnter(Collider other)
 {
    if (other.tag == "Player")
    {
       //I destroy the one that entered the door because otherwise 
       //it will be stuck walking towards the door.
       PhotonNetwork.Destroy(other.gameObject);

       Application.LoadLevel(sLevelName);
    }
 }

Then I have another function (OnLevelWasLoaded) in the same script which finds a spawnpoint then instantiates the player.

On my view everything works fine, except that I will be visible walking in the forest as well... It's as if "PhotonNetwork.Instantiate" instantiates me in all existing scenes for some reason.

I also tried being inside the house first and then open up another game (the second player), and the second player would get instantiated inside the house scene as well even if he was meant to get instantiated only in the forest...

Is there any workaround to this problem?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
3

Answer by LightDrake · Jul 07, 2015 at 06:55 AM

I solved the problem few moments after I posted the same question on ExitGames forums:

Players would show up in any scene simply because they were connected in the same room, apparently being in a "room" makes you visible even if players are all in different scenes.

So for those stumbling in the same problem, just leave the current room and make a new one (one room for each scene level) and it'll work perfectly!

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 tobiass · Jul 10, 2015 at 09:24 AM 1
Share

Correct. Players in a room see each other usually.

You could hide them, based on scene but then again, what's the usecase of sending updates but not showing them.

avatar image chandraprasadajay26 · Mar 12 at 12:07 AM 0
Share

Can you please show the code on how to create a new room for each scene i have been having the same problem

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Photon JoinRandomRoom customGameProperties? Load proper scene 0 Answers

Input.GetMouseButton on multiple objects 1 Answer

Load level after Image Sequence 0 Answers

Classic Resident Evil-style room loading/level streaming? 4 Answers

Character duplicates herself when re-entering the home level 2 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