- Home /
Question by
asd5020838 · Sep 26, 2018 at 04:40 PM ·
multiplayernetworkmultiplayer-networkingsynccommand
Network : command doesnt work...
Hi i want sync the screen host-client so i use command but it doesnt work.
Here is my code.
using System.Collections; using System.Collections.Generic; using UnityEngine.UI; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.Networking;
public class GameLobby : NetworkBehaviour {
public Image titleimage;
int songnum = 0;
int diff = 0;
int listrange;
float speed = 1.0f;
public string songname, difficulty, savecode;
string prefstring;
int Bestscore = 0;
public GameObject SongLists;
public Text Nametext, Difficultytext;
public Text Maxscoretext;
public Text startext;
public Text Speedtext;
public GameObject AudioObject;
AudioSource Audio;
[Command] public void CmdNextSong() { Audio.Stop();
if (songnum >= listrange - 1)
{
songnum = 0;
}
else { songnum++; }
Changeselect(songnum, diff);
titleimage.sprite = SongLists.GetComponent<SongList>().SongLists[songnum].titleimage;
Audio.clip = SongLists.GetComponent<SongList>().SongLists[songnum].music;
Audio.Play();
}
this is start function. [Command] public void CmdGameStart() { GameInfomation.Gamenotesheet = SongLists.GetComponent().SongLists[songnum].Notesheet[diff]; GameInfomation.speedmulti = speed * 0.75f; GameInfomation.savecode = savecode; SceneManager.LoadScene("Game"); }
when i click nextsong or start nothing happened. please help me
Comment