Code (CSharp): /// <summary> /// Adds all Unistorm components to the local players camera /// written by Paul Tricklebank /// Twitter: https://twitter.com/bigfiregamesuk /// Facebook: https://www.facebook.com/bigfiregames /// Facebook: https://www.facebook.com/aftersanctuary /// </summary> using UnityEngine ; using System.Collections ; public class AS_UnistormNetworkHelper : MonoBehaviour { //drag this script onto your local player // and drag the camera into the slot in the inspector. private GameObject RainParticles ; private GameObject Butterflies ; private GameObject LightningPosition ; private GameObject Snow ; private GameObject SnowDust ; private GameObject Leaves ; private GameObject RainStreaks ; private GameObject RainMist ; public Camera FPCamera ; void Start ( ) { //find our unistorm weather systems and attach them all to the camera. //you may ned to play with the local positions depending on your //level. RainParticles = GameObject . Find ( "Rain New" ) ; Butterflies = GameObject . Find ( "Butterflies" ) ; LightningPosition = GameObject . Find ( "Lightning Position" ) ; Snow = GameObject . Find ( "Snow New" ) ; SnowDust = GameObject . Find ( "Snow Dust" ) ; Leaves = GameObject . Find ( "Fall Leaves" ) ; RainStreaks = GameObject . Find ( "Rain Streaks" ) ; RainMist = GameObject . Find ( "Rain Mist" ) ; if ( RainParticles != null ) { RainParticles . transform . parent = FPCamera . transform ; . transform . localPosition = ( 0 , 17 , 0 ) ; RainParticles new Vector3 } if ( Butterflies != null ) { Butterflies . transform . parent = FPCamera . transform ; . transform . localPosition = ( 0 , 12 , 0 ) ; Butterflies new Vector3 } if ( Snow != null ) { Snow . transform . parent = FPCamera . transform ; . transform . localPosition = ( 0 , 17 , 0 ) ; Snow new Vector3 } if ( SnowDust != null ) { SnowDust . transform . parent = FPCamera . transform ; . transform . localPosition = ( 0 , 12 , 0 ) ; SnowDust new Vector3 } if ( Leaves != null ) { Leaves . transform . parent = FPCamera . transform ; . transform . localPosition = ( 0 , 12 , 0 ) ; Leaves new Vector3 } if ( RainStreaks != null ) { RainStreaks . transform . parent = FPCamera . transform ; . transform . localPosition = ( 0 , 12 , 0 ) ; RainStreaks new Vector3 } if ( RainMist != null ) { RainMist . transform . parent = FPCamera . transform ; . transform . localPosition = ( 0 , 12 , 0 ) ; RainMist new Vector3 } if ( LightningPosition != null ) { LightningPosition . transform . parent = FPCamera . transform ; . transform . localPosition = ( 0 , 12 , 10 ) ; LightningPosition new Vector3 } } }

Code (CSharp): //added by BigFireGames private PhotonView myPhotonView ;

Code (CSharp): [ RPC ] public void ChangeWeather ( int weatherType, float mytime, int minute, float day, float month ) { if ( ! PhotonNetwork . isMasterClient ) { weatherForecaster = weatherType ; startTime = mytime ; minuteCounter = minute ; dayCounter = day ; monthCounter = month ; Debug . Log ( "Weather changed to weather type " + weatherType ) ; } }

Code (CSharp): public void OnPhotonPlayerConnected ( ) { this . myPhotonView . RPC ( "ChangeWeather" , PhotonTargets . All , weatherForecaster,startTime, minuteCounter, dayCounter,monthCounter ) ; }

Code (CSharp): //If staticWeather is true, the weather will never change if ( staticWeather == false ) { if ( PhotonNetwork . isMasterClient ) { //20% Chance of weather change if ( weatherOdds == 20 && weatherChanceSpring == 20 || weatherOdds == 20 && weatherChanceSummer == 20 || weatherOdds == 20 && weatherChanceFall == 20 || weatherOdds == 20 && weatherChanceWinter == 20 ) { //Controls our storms from switching too often if ( stormCounter >= 13 ) { weatherForecaster = Random . Range ( 1 , 13 ) ; this . myPhotonView . RPC ( "ChangeWeather" , PhotonTargets . All , weatherForecaster, startTime, minuteCounter, dayCounter, monthCounter ) ; weatherOdds = 1 ; stormCounter = Random . Range ( 0 , 7 ) ; } } }

I've seen this asked a fair bit but I've never seen anyone answer the question so I thought I'd set an hour or so aside to figure it out.If anyone has any suggestions to improve this please feel free to let me knowHere is how I have Unistorm hooked up using Photon.Making the following changes will allow the master client to set the time of day and weather forcast on each client system.We need a script first of all to attach all of the Unistorm weather systems to our player game object:Next we need to edit the Unistorm system script.First, add a photon view to the unistorm system game object and then declare a photon view at the top of the script.Don't drag a component into the observe slot of the PhotonView component.next, add an RPC near the bottom of the script:then add this underneath your RPC so that when a new player joins the room the RPC is sent to him or her to update the current time and weather.The only values we need to sync as a bare minimum are startTime and weatherForcaster.The other values are synced incase you wish to display the date/time etc in your UI.next, go through the code and find where the weather changes.My first change was at around line 1557 and looks like this:There are 6 changes to make in all,Once you have made the changes the weather will only ever change on the master client.When that happens the RPC is sent to all the other clients to change the weather.This will not change the weather or time on other clients if you ust the Time bar or WCPS feature.It will only send the RPC when the weather changes dynamically on its own.You'll be able to see this in action here https://www.facebook.com/aftersanctuary once we actually get around to releasing out multiplayer demo.If anyone has any questions then please feel free to ask @BHS if you're unhappy with the amount of Unistorm code I've posted above please let me know and I will remove this post.I tried to keep it to the bare minimum.