I started getting this error as soon as i make my code into a dll.
Argument #' cannot convert null' expression to type UnityEngine.Vector2'
I did not tget this error when my code was just a c# script.
Okay here is a before and after synopsis.
Initially I had a regular c# script named ScriptA in my unity project .
This is ScriptA
namespace MyScript
{
public class ScriptA
{
public void MethodA(Rect rect, int i, Vector2 position = new Vector2())
{
}
}
}
I then use ScriptA.MethodA , and as you see , the Vector2 parameter is marked as = new Vector2() .awesome.

I then moved ScriptA to a Class Library and made a dll out of it . Place the dll into my unity project.
it wors , the clases are accessed, However for some reason as you see in this picture the Vector2 parameter in MethodA sa marked as = null even though in the dll it is set to = new Vector2

Default parameters always were a bit problematic in Unity. However I’ve never seen this behaviour. It’s probably the best to do what Unity does with most of it’s own defaul parameter methods: Just declare an overload
public void MethodA(Rect rect, int i, Vector2 position)
{
// your actual method
}
// overload without the Vector2 parameter
public void MethodA(Rect rect, int i)
{
MethodA(rect, i, Vector3.zero);
}