title: Copying a string into a list isn't working - C#, Unity3D
body: <p>I have a dialogue system and a journal system that should allow the player to copy dialogue lines that have just been said into their journal, however, copying the strings into the list isn't working.</p>
  
  <p>I've been using <code>string.Copy</code> to copy the value of the string instead of the reference, but it doesn't copy anything over at all. Cutting <code>string.Copy</code> and copying the reference doesn't appear to work either. The line I'm copying from does have a value, I printed a <code>debug.log</code> to print the value for it before printing the value of the list items (see below)(edited to include full script).</p>
  
  <pre class="lang-cs prettyprint-override"><code>public class JournalTester : MonoBehaviour
  {
      public List&lt;DiaEntryClass&gt; diaJournal = new List&lt;DiaEntryClass&gt;();
  
      GameObject diaSysObject;
      private DialogueSystem diaSysScript;
      string testLine = "inital value for testline";
      string testName = "Initial NPC name value";
  
      private void Update()
      {
          if (Input.GetKey("k"))
          {
              Debug.Log("K");
              diaSysObject = GameObject.Find("DialogueSystem");
              diaSysScript = diaSysObject.GetComponent&lt;DialogueSystem&gt;();
              testLine = diaSysScript.justSaid;
              testName = diaSysScript.justSpoke;
  
              Debug.Log("testLine post copy: " + testLine);
  
  
              diaJournal.Add(new DiaEntryClass(string.Copy(testLine), "Bernard's Apartment", string.Copy(testName)));
              Debug.Log("Using the string.Copy method.....................................................");
              Debug.Log("Dialogue Journal, Entry 0, Line: " + diaJournal[0].line);
              Debug.Log("Dialogue Journal, Entry 0, Character: " + diaJournal[0].character);
              Debug.Log("Dialogue Journal, Entry 0, Location: " + diaJournal[0].location);
  
              diaJournal.Add(new DiaEntryClass(testLine, "Bernard's Apartment", testName));
              Debug.Log("Not using the string.Copy method..................................................");
              Debug.Log("Dialogue Journal, Entry 1, Line: " + diaJournal[1].line);
              Debug.Log("Dialogue Journal, Entry 1, Character: " + diaJournal[1].character);
              Debug.Log("Dialogue Journal, Entry 1, Location: " + diaJournal[1].location);
          }
        }
      }
  
  
  public class DiaEntryClass
  {
      public string line;
      public string location;
      public string character;
  
      public DiaEntryClass (string line, string location, string character)
      {
          line = "initial line";
          location = "initial location";
          character = "character";
      }
  }
  </code></pre>
  
  <p>Above is the custom class I'm using for dialogue entries. 
  But no matter what I do, it doesn't seem to work like that. Below is my <code>Debug.Log</code> lines: </p>
  
  <blockquote>
    <p>testLine post copy: Hello! My name is John Doe Using the string.Copy
    method..................................................... Dialogue
    Journal, Entry 0, Line:  Dialogue Journal, Entry 0, Character:
    Dialogue Journal, Entry 0, Location:  Not using the string.Copy
    method.................................................. Dialogue
    Journal, Entry 1, Line:  Dialogue Journal, Entry 1, Character Dialogue
    Journal, Entry 1, Location:</p>
  </blockquote>
  
  <p>The Character string should print as "John".
  The Line string should print as "Hello! My name is John Doe."
  The Location string should print as "Bernard's Apartment".
  So <code>testLine</code> does have the correct value, since it did successfully print the test line I was using, but that value isn't transferring over into the list and I don't know why. I couldn't find anything about <code>String.Copy</code> in the Unity Documentation, so I was worried I was using something wrong? I don't know for sure.</p>