title: Unity : Delegate `System.Action' does not take `1' arguments
body: <p>I have the following code:</p>
  
  <pre><code>socket.On ("chat", (data) =&gt; {
                  string str = data.ToString ();
  
                  ChatData chat = JsonConvert.DeserializeObject&lt;ChatData&gt; (str);
                  string strChatLog = "user#" + chat.id + ": " + chat.msg;
  
                  int pos = userArr.IndexOf (chat.id);
                  if (pos &gt; -1) {
                      var InsObj = Instantiate (player, StringToVector3 (chat.msg), Quaternion.identity);
                      InsObj.name = chat.id;
                      userArr [userArr.Length + 1] = chat.id;
                  }
  
                  // Access to Unity UI is not allowed in a background thread, so let's put into a shared variable
                  lock (chatLog) {
                      chatLog.Add (strChatLog);
                  }
              });
  </code></pre>
  
  <p>When I try to run it I get this error:</p>
  
  <pre><code>Assets/SocketIO/SocketIOScript.cs(59,23): error CS1593: Delegate `System.Action' does not take `1' arguments
  </code></pre>
  
  <p>However when I remove this part :</p>
  
  <pre><code>int pos = userArr.IndexOf (chat.id);
                  if (pos &gt; -1) {
                      var InsObj = Instantiate (player, StringToVector3 (chat.msg), Quaternion.identity);
                      InsObj.name = chat.id;
                      userArr [userArr.Length + 1] = chat.id;
                  }
  </code></pre>
  
  <p>It works just fine. </p>
  
  <p>I am wondering why this is happening, I have been trying to figure it out for quite a while. I found <a href="https://stackoverflow.com/questions/4466859/delegate-system-action-does-not-take-0-arguments-is-this-a-c-sharp-compiler">this</a> post about it, but that did not help me much, because I don't <em>think</em> that I can specify <code>data</code>.</p>
  
  <p>EDIT:</p>
  
  <p><code>StringToVector3</code> contains the following code (However even if I get rid of <code>StringToVector3</code> I still get the error):</p>
  
  <pre><code>public static Vector3 StringToVector3 (string sVector)
      {
          // Remove the parentheses
          if (sVector.StartsWith ("(") &amp;&amp; sVector.EndsWith (")")) {
              sVector = sVector.Substring (1, sVector.Length - 2);
          }
  
          // split the items
          string[] sArray = sVector.Split (',');
  
          // store as a Vector3
          Vector3 result = new Vector3 (
                               float.Parse (sArray [0]),
                               float.Parse (sArray [1]),
                               float.Parse (sArray [2]));
  
          return result;
      }
  </code></pre>