All variables are passed by value in functions. However, there is nuance:

  • For a value type, this means a copy of the value is made (int, struct)
  • For a reference type, a copy of the reference is made (class). This means that the object itself is not copied. For example:
class Person
{
    public int number;
}
 
class Test
{
    private void Manipulate(Person person) {
        person.number = 5;
    }
 
    private bool Start() {
        Person p = new Person();
        p.number = 1;
 
        // This modifies `p` because a copy of the *reference*
        // is passed in, but no true deep clone of the object was made
        Manipulate(p);
  
        // Returns `true`
        return p.number == 5;
    }
}