Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by zero84085 · Aug 22, 2012 at 08:41 PM · c#errorconstantnewline

C# Newline in constant.

hello guys i am a little bit new to c# and i have make a script but i dont khow what that error mean "Newline in constant" can anyone help? ... here is my code: using UnityEngine; using System.Collections; using System.Collections.Generic;

 public class MultiplayerManager : MonoBehaviour
 {
   public static MultiplayerManager instance;
   
   public string PlayerName;
   
   private string MatchName = "";
   private string MatchPassword = "";
   private int MatchMaxUsers = 24;
   
   public List PlayerList = new List();
  
   void Start()
   {
       instance = this;
 	  PlayerName = PlayerPrefs.GetString("PlayerName");
   }
   public void StartServer(string serveraname, string serverpassword, int maxusers)
   {
        MatchName = servername;
 	   MatchPassword = serverpassword;
 	   MatchMaxUsers = maxusers;
 	   Network.InitializeServer(MatchMaxUsers, 2550, false);
 	   MasterServer.RegisterHost("DeathMatch", MatchName, "");
 	   //Network.InitializeSecurity();
   }
    void OnServerInitialized()
    {
        Server_PlayerJoinRequest(PlayerName, Network.player);
    }
    void OnConnectedToServer()
    {
        network.RPC("Server_PlayerJoinRequest",RPCMode.Server, PlayerName, Network.player);
       }  
    }
    void OnPlayerDisconnected()
   {
        networkView.RPC("Client_RemovePlayer,RPCMode.All, id);
   }
   [RPC]
   void Server_PlayerJoinRequest(string playername, NetworkPlayer view);
   {
      networkView.RPC("Client_AddPlayerToList", RPCMode.All, playername, view)
    }  
    [RPC]
    void Client_AddPlayerToList(string playername, NetworkPlayer view)
    {
     MPPlayer tempplayer = new MPPlayer();
 	tempplayer.PlayerName = playername;
 	tempplayer.PlayerNetwork = view;
 	PlayerList.Add(tempplayer);
    }
    [RPC]
    void Client_RemovePlayer(NetworkPlayer view)
   {
   MPPlayer temppl = null;
   foreach(MPPlayer pl in PlayerList)
   {
     if(pl.PlayerNetwork == view)
   {
     temppl = pl;
   }
   }   
   if(temppl != null)
   { 
    PlayerList.Remove(temppl);
      }
    }
    public class MPPlayer
   {
   public string PlayerName = "";
   public NetworkPlayer PlayerNetwork;
   }
   }
Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image J3-Gaming · Aug 22, 2012 at 09:11 PM 0
Share

When posting code please format it correctly.

Edit your post, select all the code and hit the 'code snippet' button

avatar image Bunny83 · Aug 22, 2012 at 09:20 PM 1
Share

I can't format it for you since UA finally totally f**** up every post. The generic parameters are missing totally now... It's getting worse with each update.

Please edit your post, remove your old code and insert your original code, but this time don't forget to press the "101/010" button after you selected all your code.

avatar image DaveA · Aug 22, 2012 at 09:29 PM 0
Share

Is this thing still Qato or is it something else? Horrible system.

avatar image Bunny83 · Aug 23, 2012 at 12:34 AM 0
Share

It is still qato, but i don't think it's a general problem with the system. They have implemented a lot new stuff. Right after the switch we had much less problems...

Well they implemented some auto-conversion to html which were done at certain time intervals in the past (at least that was my experience). In it's current form it's near to be unusable. $$anonymous$$ost work on this site in the past was fixing wrongly formatted code. Now it's a real pain in the a**. All text get it's special characters html-escaped and generic parameters, which of course would be interpreted as html tags, are just stripped away.

When i post something and i click "edit", i expect to be able to edit what i've just posted or at least something that's "almost" the same, but at the moment the text is totally screwed up. I don't want to spend 10 $$anonymous$$ to fix what the webserver has f* up in less then 2ms.

avatar image DaveA · Aug 23, 2012 at 12:42 AM 0
Share

I've run into that too. Unless it's small, I just avoid it now.

1 Reply

· Add your reply
  • Sort: 
avatar image
3

Answer by DaveA · Aug 22, 2012 at 09:19 PM

Yes you should format your code, but that error is usually because you didn't have matching double-quotes on a string.

In Chrome, you can search, search for " and it hightlights all the " on the page.

Easy to see:

networkView.RPC("Client_RemovePlayer,RPCMode.All, id);

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image zero84085 · Aug 22, 2012 at 10:20 PM 0
Share

i format and fix my code view!

avatar image DaveA · Aug 23, 2012 at 12:43 AM 0
Share

Did you see the error in the line I put in my answer, did you fix that?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

how do i fix (error CS1010 Newline in constant) 1 Answer

Multiple Cars not working 1 Answer

Help I am getting an error CS0079 in my code and I don't know why. 1 Answer

Particle circle HELP 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges