RPC Color.Lerp
So i made my TOD(time of day) script work through network but i encountered to the folowing problem my skboxes or color of the sky changes as the time pass by for this i used Color.Lerp when iam hosting some game i can see how smoothly sky changes. But when iam playing as a client skyboxes does not lerp they just change from one color to another without smooth. I am so confused right now because i don't know what exactly to do. And also ia have another problem i don't know how to change light Intensity through network i tried rpc call but it didn't work. I am attaching also my TOD script here : using UnityEngine; using System.Collections; public class TimeOfDay : MonoBehaviour { %|326528793_1|% %|1349614966_2|% public float Hour = 14; %|825521709_4|% public Light sun; %|744680064_7|% %|-1353448817_8|% %|-1400358258_9|% %|516075851_10|% %|474590980_12|% public Color DuskFogColor; public Color MorningFogColor; %|131711687_15|% %|1544107518_16|% public Color NightAmbientLight; public Color DuskAmbientLight; %|-1458133773_19|% public Color MiddayAmbientLight; %|-527775879_21|% %|843871461_22|% %|1706357192_23|% %|1376173752_24|% %|-42259459_25|% %|297837856_26|% %|1271815733_27|% public Material SkyBoxMaterial2; %|1104761904_30|% %|-820288095_31|% %|877957198_32|% %|-647247510_33|% %|-416881083_34|% %|-1085665453_35|% %|1545882607_36|% %|-140153543_37|% %|-1243984715_38|% void Start () { %|-770558535_41|% } %|319604241_43|% %|346792142_44|% %|223938316_45|% %|835420831_46|% %|1264280838_47|% %|-1195298554_48|% %|1806624139_49|% } %|2042673305_51|% %|103382514_52|% networkView.RPC ("SoundNight", RPCMode.AllBuffered); %|-1767032627_54|% %|-842653949_55|% { networkView.RPC ("SoundDay", RPCMode.AllBuffered); %|-1148583551_58|% if(Tod>8&&Tod<10) %|2069481542_60|% %|345656225_61|% } %|-439530568_63|% %|1255576148_64|% } %|-1815196618_66|% %|-2054130026_67|% if (slider >= 1.0) { slider = 0; %|-1810667023_70|% slider = GUI.HorizontalSlider (new Rect (20, 20, 200, 30), slider, 0, 1.0f); //if (nView.isMine) //{ %|-2140293936_75|% %|-2000008057_76|% %|-1862995920_77|% %|1227279016_78|% %|-82782536_79|% %|-111995997_80|% if (slider < 0.5) { %|1134835035_83|% } if (slider > 0.5) { %|-695415770_86|% %|-1736335212_87|% %|-556922883_88|% %|-1175558066_89|% Tod = slider2 * 24; %|-792815660_91|% %|1959657838_92|% //it is Night if(Network.isServer) { %|481282465_96|% %|-372285317_97|% } %|2100168505_99|% %|-1701426148_100|% %|-986892620_101|% networkView.RPC("Time2", RPCMode.AllBuffered); } %|-506540136_104|% %|-283460589_105|% } if(Tod > 6 && Tod < 8){ %|-315200488_108|% %|226254305_109|% networkView.RPC("Time3", RPCMode.AllBuffered); } %|1547193916_112|% %|464623576_113|% if(Tod > 8 && Tod < 10){ %|1488794818_115|% { networkView.RPC("Time4", RPCMode.AllBuffered); %|1409637401_118|% %|1618911362_119|% %|683871677_120|% %|663321042_121|% %|158325286_122|% %|874094169_123|% %|-396061983_124|% RenderSettings.skybox = SkyBoxMaterial1; RenderSettings.skybox.SetFloat ("_Blend", 0); SkyBoxMaterial1.SetColor ("_Tint", NightTint); RenderSettings.ambientLight = NightAmbientLight; %|326022603_129|% %|-801683943_130|% %|16272582_131|% void Time2() %|1287144338_133|% %|-154084831_134|% %|276711894_135|% %|1841334842_136|% %|654238163_137|% %|814643437_138|% RenderSettings.fogColor = Color.Lerp (NightFogColor, DuskFogColor, (Tod / 2) - 2); %|2032913768_140|% %|-1002148889_141|% %|239772722_142|% { %|-105732807_144|% %|-1832035652_145|% RenderSettings.skybox.SetFloat ("_Blend", (Tod / 2) - 3); %|-1376045994_147|% %|-179158054_148|% %|-1996512808_149|% %|-405354034_150|% %|345631957_151|% %|-2067621348_152|% %|-1411131234_153|% RenderSettings.ambientLight = MiddayAmbientLight; %|188098573_155|% %|-1593273208_156|% %|-1615252528_157|% %|-489316232_158|% RenderSettings.fogColor = Color.Lerp (MorningFogColor, MiddayFogColor, (Tod / 2) - 4); %|-632908362_160|% %|1779503957_161|% %|1893111644_162|% if(!nView.isMine) %|-345390626_164|% %|149891131_165|% %|-1659932826_166|% %|2054723808_167|% %|-1591218257_168|% %|-826837250_169|% %|-1296596952_170|% sun.intensity = (slider2 - 0.2f) * 1.4f; if(Tod>5&&Tod<7) %|-813450742_173|% %|164983298_174|% //sunObject.GetComponent<Light>().enabled = false; %|310784258_176|% %|504227966_177|% %|-522274925_178|% %|-322759266_179|% //sunObject.GetComponent<Light>().enabled = true; %|620094770_181|% %|-900683155_182|% [RPC] void SoundDay() %|1627691515_185|% %|1618099975_186|% %|-456081545_187|% clouds.SetActive (true); } %|1894286327_190|% %|1350940946_191|% { nightSoundObj.SetActive (true); %|95903840_194|% %|2136021176_195|% %|-1230236261_196|% }
Thanks for any help.
Your answer
![](https://koobas.hobune.stream/wayback/20220612073457im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Null Pointer at RPC Call Unity Network 0 Answers
Client can't answer to Server, Command methods don't work, ClientRPC do 0 Answers
Simple ClientRpc Whats wrong with it? 0 Answers
ClientRpc s are not called 1 Answer
SyncVar works not always 0 Answers