Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Multiplayer day/night issue

Discussion in 'Editor & General Support' started by mumbot, May 10, 2014.

  1. mumbot

    mumbot

    Joined:
    Oct 19, 2012
    Posts:
    86
    Hello all unity3D members i have a really big issue i am using Photon unity networks for my multiplayer game and i have successfully made it so players can join and play no problem but the problem is with my Day/Night system by Default its set to Night. But when a player joins then another 5 mins later the Cycles are differnt one person may be in Night time the other at Day and i cant figur this out iv tryed adding a photon view to my Light and add the Transform in the Observe part but it still does the same thing so can someone please help me

    ~ Thanks

    --------
    Sorry for my poor english as i am Italian
     
  2. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,605
    Use the function as an RPC and send it to everyone.
     
  3. mumbot

    mumbot

    Joined:
    Oct 19, 2012
    Posts:
    86
    Im sorry not to sure how could you place explain i am new to Photon and multiplayer side of things in unity
     
  4. carking1996

    carking1996

    Joined:
    Jun 15, 2010
    Posts:
    2,605
    An RPC even is when you put [RPC] in front of a function:

    Code (csharp):
    1.  
    2. [RPC]
    3. void myFunction(){
    4. }
    5.  
    And then you can call the function in Update:

    Code (csharp):
    1.  
    2. void Update(){
    3.      myPhotonview = gameObjectwithScriptOnIt.GetComponent<PhotonView>();
    4.      myPhotonView.myPhotonView.RPC("myFunction", PhotonTargets.All);
    5. }
    6.  
    This explains a lot: http://doc.exitgames.com/en/pun/current/tutorials/tutorial-marco-polo
     
    pandasonicpdx likes this.
  5. mumbot

    mumbot

    Joined:
    Oct 19, 2012
    Posts:
    86
    Thanks alot it works perfectly now
     
  6. sonnolo

    sonnolo

    Joined:
    Feb 22, 2015
    Posts:
    26
    Ciao mumbot potresti aiutarmi per favore?Io ho il solito problema,il ciclo giorno/notte non e'sincronizzato tra i giocatori nel server