Hello dear Unity users! I ask you to help me with the error (27,9): error CS1003: Syntax error, ',' expected here is the script: Code (CSharp): using UnityEngine; using System.Collections; public class ChatLog : MonoBehaviour { private GameManager gameManage; public string Log; public Color TextColor = Color.white; public bool ActiveChat; public float ShowTextDuration = 5; float timeTemp; void Start () { gameManage = (GameManager)GameObject.FindObjectOfType (typeof(GameManager)); } public void AddLog (string text) { if (Network.isClient || Network.isServer) { if (GetComponent<NetworkView>()) GetComponent<NetworkView>().RPC ("SendChatMessage", RPCMode.All, text); } } [Unity Multiplayer] void SendChatMessage (string text) { Log += "\n" + text; timeTemp = Time.time; showLog = true; } bool showLog = false; void Update () { if (!gameManage) return; if (Input.GetKeyDown (KeyCode.Return)) { ActiveChat = !ActiveChat; if (ActiveChat) { timeTemp = Time.time; showLog = true; } } if (showLog) { if (Time.time >= timeTemp + ShowTextDuration) { showLog = false; } } } public void Clear () { Log = string.Empty; } string chattext = ""; void OnGUI () { if (!gameManage || !gameManage.IsPlaying) return; GUI.skin.label.fontSize = 17; GUI.skin.label.normal.textColor = TextColor; GUI.skin.label.alignment = TextAnchor.LowerLeft; if (showLog) GUI.Label (new Rect (10, 10, Screen.width, 200), Log); if (ActiveChat) { timeTemp = Time.time; GUI.SetNextControlName ("Chattext"); chattext = GUI.TextField (new Rect (10, 210, 200, 20), chattext); if (Event.current != null && Event.current.keyCode == KeyCode.Return) { if (chattext != string.Empty) { AddLog ("<color=yellow>" + PlayerPrefs.GetString ("user_name") + " : </color>" + chattext); ActiveChat = false; chattext = string.Empty; } } GUI.FocusControl ("Chattext"); } } } Error: Assets\Scripts\Components\ChatLog.cs(27,9): error CS1003: Syntax error, ',' expected
There will still be an error if I enter [UnityMultiplayer] Instead of [Unity Multiplayer] there will be 111 more errors because the scripts are interconnected
The forums are not here to help you solve hundreds of errors in your typing. It's too much to ask of other devs. The basics such as names of attributes should be retrieved from docs or tutorials. If devs wish to help then that's up to them but your problems will be seemingly never-ending because if someone fixes one thing for you, you'll move onto the next and say, "it didn't work". Wherever you got this code, please go back and check it against the original. If you see the above attribute somewhere else, then make sure you use it correctly. Correct C# syntax is something you need to learn. Final note: Please don't use the forums like a chat room, posting multiple one-line messages. You can edit your posts here, it's a forum.
I understand that 111 errors will not help me solve, but help with this one, which I asked a question about on the Unity forum
And you got the help you asked for. What docs are you using and where did you see this attribute mentioned? Can you please post a link here.
When I insert [UnityMultiplayer] (Without spaces), then I have 111 errors, I don't understand why it could be
PLEASE STOP MAKING MULTIPLE POSTS. PLEASE EDIT YOUR POSTS. THIS IS NOT A WEB-CHAT. First, UNET was deprecated years ago. See here. I'm certainly not going to that link though. Second, I'm not familiar with it anyway but I've never heard of that attribute so the answer to your question is, I'll move your post to the UNET forums here. Someone there might understand what the correct attribute is or advise you better.
Sometimes errors cause other errors, because the compiler is confused. Sometimes errors stop other errors from appearing because the compiler stops before compiling the rest. Just because these other problems did not appear before, does not mean it was fine before. Always starts with the first error and work through them in order. Solving one error might solve one hundred, or it might cause further. Eventually you will have solved them all tho. If you wrote that code yourself you either introduced many many typos (like the space in the attribute), or if you downloaded the code as is.. you should probably give up on that source.