Quick answer: CS1503 means one of the values you passed to a method has a type the method’s parameter does not accept. Argument 2 is the second value between the brackets, from 'A' is the type you passed and to 'B' is the type the parameter wants. Pass a B: call the coroutine (StartCoroutine(Fade())), drop the brackets for a listener (AddListener(StartGame)), use .position where a Vector3 is wanted, Quaternion.identity for a rotation, and 1.5f for a float.
The Console shows “Argument 1: cannot convert from” followed by two type names, and the script will not compile. The compiler found the method you are calling, compared each value you passed against the parameter in the same position, and one of them did not fit. The message tells you which position and which two types, so the fix is usually visible once you read it in order. This guide explains the three parts of the message, why it sometimes names a type you never meant to use, and the Unity calls that trigger it: StartCoroutine, Invoke, AddListener, Instantiate, vector and float arguments, and out parameters.
- The exact error
- How to read the message
- CS1503 and the errors next to it
- The Unity cases, by the types in the message
- Fix 1: brackets on a method name, or missing from one
- Fix 2: pass the Unity type the parameter asks for
- Fix 3: double, float, int and string arguments
- Fix 4: out and ref parameters
- Arguments that compile and are still wrong
- What Bugnet can see of this
- Related guides
- Frequently asked questions
The exact error
Assets/Scripts/Spawner.cs(21,24): error CS1503: Argument 1: cannot convert from 'method group' to 'string'
Assets/Scripts/Spawner.cs(27,55): error CS1503: Argument 3: cannot convert from 'UnityEngine.Vector3' to 'UnityEngine.Quaternion'
Assets/Scripts/Menu.cs(14,41): error CS1503: Argument 1: cannot convert from 'void' to 'UnityEngine.Events.UnityAction'
The line and column in brackets point at the offending value, not at the start of the statement. Double-click the Console entry and the cursor lands on it. This is a compile error: it appears when scripts recompile in the editor and when a player build compiles, and nothing runs until it is gone.
How to read the message
There are three parts.
Argument Ncounts the values between the brackets of the call from the left, starting at 1. InInstantiate(prefab, position, rotation), argument 3 isrotation.from 'A'is the type of the value you wrote in that position.to 'B'is the type of the parameter in that position.
Two values of A are not ordinary types:
'method group'means you wrote a method’s name without brackets, so you passed the method itself. That is correct when the parameter is a delegate such asUnityAction, and wrong when it wants a string, anIEnumeratoror a value.'void'means you called a method that returns nothing and passed the result. The usual cause is a pair of brackets that should not be there.
Why the “to” type can be one you never intended
Many Unity methods have several overloads. When none of them accepts your arguments, the compiler reports the mismatch against one of them, in practice the first one declared, and that may not be the one you were aiming for. StartCoroutine is the well-known case: its first overload is StartCoroutine(string methodName), so passing a wrong value reports to 'string' even though you meant the IEnumerator overload. Read B as “one of the things this method accepts here”, then check the full list of overloads in your editor’s parameter hint (in Visual Studio and VS Code, Ctrl+Shift+Space inside the brackets).
CS1503 and the errors next to it
| Code | Message | What is wrong |
|---|---|---|
| CS1503 | Argument 1: cannot convert from 'A' to 'B' | Right number of arguments, wrong type in one position. |
| CS1620 | Argument 2 must be passed with the 'out' keyword | The parameter is out or ref and you passed a plain value. |
| CS1615 | Argument 2 may not be passed with the 'out' keyword | You wrote out or ref where the parameter is an ordinary one. |
| CS1501 | No overload for method 'Translate' takes 5 arguments | Wrong number of arguments for every overload. |
| CS0029 | Cannot implicitly convert type 'A' to 'B' | The same type mismatch in an assignment or return instead of a call. |
CS0029 and CS1503 share most of their causes. If your mismatch is on the left of an =, the Unity cases are in the CS0029 guide.
The Unity cases, by the types in the message
| Call that fails | Types in the message | Fix |
|---|---|---|
StartCoroutine(Fade); | 'method group' to 'string' | StartCoroutine(Fade()); |
Invoke(Respawn, 2f); | 'method group' to 'string' | Invoke(nameof(Respawn), 2f); |
button.onClick.AddListener(StartGame()); | 'void' to 'UnityEngine.Events.UnityAction' | AddListener(StartGame); |
button.onClick.AddListener(LoadLevel); where LoadLevel(int) | 'method group' to 'UnityEngine.Events.UnityAction' | AddListener(() => LoadLevel(3)); |
Instantiate(prefab, firePoint, Quaternion.identity); | 'UnityEngine.Transform' to 'UnityEngine.Vector3' | firePoint.position |
Instantiate(prefab, firePoint.position, Vector3.zero); | 'UnityEngine.Vector3' to 'UnityEngine.Quaternion' | Quaternion.identity or Quaternion.Euler(...) |
Vector3.Distance(transform, target.position); | 'UnityEngine.Transform' to 'UnityEngine.Vector3' | transform.position |
transform.SetParent(holderObject); | 'UnityEngine.GameObject' to 'UnityEngine.Transform' | holderObject.transform |
ApplyDamage(collision.gameObject); where ApplyDamage(Enemy) | 'UnityEngine.GameObject' to 'Enemy' | GetComponent<Enemy>() on the object |
audioSource.PlayOneShot("Jump"); | 'string' to 'UnityEngine.AudioClip' | Pass an AudioClip field |
new Vector3(0, 1.5, 0) | 'double' to 'float' | 1.5f |
PlayerPrefs.SetInt("Best", scoreText.text); | 'string' to 'int' | Pass the int, or parse the text |
Physics.Raycast(origin, direction, hit); | 'UnityEngine.RaycastHit' to 'float' | out hit |
Fix 1: brackets on a method name, or missing from one
Three Unity APIs take “a method” in three different forms, which is why this group produces so many CS1503 lines.
StartCoroutine wants the result of calling the method
IEnumerator Fade()
{
yield return new WaitForSeconds(1f);
}
// Broken
StartCoroutine(Fade); // Argument 1: cannot convert from 'method group' to 'string'
// Fixed
StartCoroutine(Fade());
Calling Fade() does not run the coroutine. It builds an IEnumerator object, and StartCoroutine is what runs it. Two related messages have the same shape. from 'void' means the method is declared void and must return IEnumerator. from 'System.Collections.IEnumerable' means the return type is spelled IEnumerable where it should be IEnumerator. If the code compiles and the coroutine still does nothing, see a coroutine that doesn’t run.
Invoke and InvokeRepeating want the name as text
// Broken
Invoke(Respawn, 2f); // 'method group' to 'string'
Invoke(Respawn(), 2f); // 'void' to 'string'
// Fixed
Invoke(nameof(Respawn), 2f);
InvokeRepeating(nameof(SpawnWave), 1f, 5f);
nameof(Respawn) produces the string "Respawn" at compile time, so a rename or a typo is caught by the compiler. A hand-typed "Respwan" compiles and fails only when the game runs.
AddListener wants the method itself
// Broken
startButton.onClick.AddListener(StartGame()); // 'void' to 'UnityEngine.Events.UnityAction'
levelButton.onClick.AddListener(LoadLevel); // LoadLevel(int): 'method group' to 'UnityEngine.Events.UnityAction'
volumeSlider.onValueChanged.AddListener(Mute); // Mute(): 'method group' to 'UnityEngine.Events.UnityAction<float>'
// Fixed
startButton.onClick.AddListener(StartGame); // void StartGame()
levelButton.onClick.AddListener(() => LoadLevel(3));
volumeSlider.onValueChanged.AddListener(SetVolume); // void SetVolume(float value)
With brackets, StartGame() runs immediately and its result, nothing, is handed to AddListener. Without brackets you pass the method, which is what a listener is. The method’s parameters must match the event: Button.onClick calls a method with no parameters, and Slider.onValueChanged calls one that takes a float. When you need to pass your own value, wrap the call in a lambda.
One lambda trap compiles cleanly. Inside a for loop, () => LoadLevel(i) captures the variable i, not its value at that moment, so every button loads the last level. Copy it first: int level = i; and then () => LoadLevel(level).
Fix 2: pass the Unity type the parameter asks for
// Broken
Instantiate(bulletPrefab, firePoint, Quaternion.identity); // Argument 2: 'UnityEngine.Transform' to 'UnityEngine.Vector3'
Instantiate(bulletPrefab, firePoint.position, Vector3.zero); // Argument 3: 'UnityEngine.Vector3' to 'UnityEngine.Quaternion'
float d = Vector3.Distance(transform, target.position); // Argument 1: 'UnityEngine.Transform' to 'UnityEngine.Vector3'
transform.SetParent(holderObject); // Argument 1: 'UnityEngine.GameObject' to 'UnityEngine.Transform'
ApplyDamage(collision.gameObject); // Argument 1: 'UnityEngine.GameObject' to 'Enemy'
audioSource.PlayOneShot("Jump"); // Argument 1: 'string' to 'UnityEngine.AudioClip'
// Fixed
Instantiate(bulletPrefab, firePoint.position, firePoint.rotation);
Instantiate(bulletPrefab, firePoint.position, Quaternion.identity);
float d = Vector3.Distance(transform.position, target.position);
transform.SetParent(holderObject.transform);
if (collision.gameObject.TryGetComponent(out Enemy enemy))
{
ApplyDamage(enemy);
}
audioSource.PlayOneShot(jumpClip); // [SerializeField] private AudioClip jumpClip;
The pattern is the same in each line: you passed the object that has the thing, and the parameter wants the thing.
- A position is a
Vector3, not aTransform. Take.position. This applies toVector3.Distance,Vector3.MoveTowards,Vector3.Lerpand the position argument ofInstantiate. - A rotation is a
Quaternion, not aVector3. UseQuaternion.identityfor no rotation, another object’s.rotationto copy one, orQuaternion.Euler(0f, 90f, 0f)to build one from angles. - A parent is a
Transform, not aGameObject. Take.transform. - Your script is a component on the GameObject, not the GameObject. Fetch it with
GetComponent<Enemy>()orTryGetComponent.TryGetComponentreturnsfalsewhereGetComponentwould returnnull, which matters because not everything you collide with is an enemy. - An asset is not its name. Methods that play, show or spawn something take the asset itself (an
AudioClip, aSprite, a prefab). Add a serialized field and assign it in the Inspector.
Fix 3: double, float, int and string arguments
// Broken
transform.position = new Vector3(0, 1.5, 0); // Argument 2: 'double' to 'float'
Destroy(gameObject, 2.5); // Argument 2: 'double' to 'float'
PlayerPrefs.SetInt("Best", score * 1.5f); // Argument 2: 'float' to 'int'
PlayerPrefs.SetInt("Best", scoreText.text); // Argument 2: 'string' to 'int'
// Fixed
transform.position = new Vector3(0, 1.5f, 0);
Destroy(gameObject, 2.5f);
PlayerPrefs.SetInt("Best", Mathf.RoundToInt(score * 1.5f));
PlayerPrefs.SetInt("Best", score);
A number with a decimal point and no suffix is a double, and almost every Unity parameter is a float. Add f. Whole numbers need no suffix because int converts to float automatically, which is why only the 1.5 is reported in the first line and the two zeros are fine.
The reverse does not convert automatically: a float will not go into an int parameter without a rounding call or an (int) cast. Text never converts to a number by itself. If the value exists as a number in your script, pass that instead of the label that displays it. If it only exists as text, parse it with int.TryParse.
Fix 4: out and ref parameters
// Broken
if (inventory.TryGetValue("key", item)) { } // CS1620: Argument 2 must be passed with the 'out' keyword
x = Mathf.SmoothDamp(x, targetX, velocity, 0.3f); // CS1620: Argument 3 must be passed with the 'ref' keyword
if (Physics.Raycast(origin, direction, hit)) { } // CS1503: Argument 3: 'UnityEngine.RaycastHit' to 'float'
// Fixed
if (inventory.TryGetValue("key", out Item item)) { }
x = Mathf.SmoothDamp(x, targetX, ref velocity, 0.3f); // velocity is a float field
if (Physics.Raycast(origin, direction, out RaycastHit hit)) { }
An out parameter is how a method hands back a second result, and a ref parameter is one the method reads and updates. C# makes you repeat the keyword at the call so that it is visible the variable will change. When the method has a single matching overload, a missing keyword is reported as CS1620. With a heavily overloaded method such as Physics.Raycast, the compiler compares your arguments against an overload that has no out parameter in that position, here Raycast(Vector3, Vector3, float), and reports CS1503 with a puzzling to 'float'. The fix is the same either way: add out.
Writing the type inside the call, out RaycastHit hit, declares the variable on the spot. If you declared it earlier, write out hit.
Arguments that compile and are still wrong
The compiler only checks that a conversion exists. Three Unity calls pass that check with the wrong meaning, and fixing a CS1503 by trial and error can land you in one of them.
- A
LayerMaskin the distance position.Physics.Raycast(origin, direction, groundMask)compiles, because aLayerMaskconverts tointand anintconverts tofloat. The mask is then used asmaxDistanceand no layer filter is applied. Pass both:Physics.Raycast(origin, direction, out hit, 10f, groundMask). - A layer index where a mask is wanted.
LayerMask.NameToLayer("Ground")returns the layer’s number, and the physics queries want a bit mask. UseLayerMask.GetMask("Ground"), or aLayerMaskfield set in the Inspector. Passing the layer’s name as a string does not compile at all. - String-based coroutines. Changing
StartCoroutine(Fade)toStartCoroutine("Fade")silences the compiler by choosing the string overload. It works, but the name is no longer checked at compile time. PreferStartCoroutine(Fade()).
After any fix, save, let Unity recompile, and then run the line in Play mode. A compile error that is gone proves the types line up. It does not prove you passed the right object.
What Bugnet can see of this
CS1503 never reaches Bugnet. The script does not compile, so there is no build and nothing running that could file a report. The related failures are the ones the fixes above can introduce at runtime: GetComponent<Enemy>() returning null for an object that has no such component and the next line throwing a NullReferenceException, a serialized AudioClip or prefab field that was never assigned in one scene, or int.Parse throwing on text a player typed. Those are exceptions in a running game, and the Bugnet Unity SDK files them through Unity’s log callback with the stack trace, recent log lines, game version, platform and OS, stacking repeats of the same title into one entry with a count.
The cases in the previous section are different. A ray that uses a mask as its distance, or a button that loads the wrong level, throws nothing and logs nothing, so there is no automatic report. What arrives is a player’s description through the in-game form (“I fall through the floor in level 3”) with their device details attached, and working back from that to an argument in the wrong position is still your job. Setup is covered in getting started.
Related guides
- How to Fix “error CS0029: Cannot implicitly convert type” in Unity
- How to Fix “error CS1061: does not contain a definition for” in Unity
- How to Fix “error CS0120: An object reference is required for the non-static field, method, or property” in Unity
- How to Fix a Coroutine That Doesn’t Run in Unity
- How to Fix Unity’s NullReferenceException
Frequently asked questions
What does error CS1503 mean in Unity?
One of the values passed to a method has a type that the parameter in that position does not accept. The argument number counts from the left starting at 1, the first type is what you passed and the second is what the parameter wants.
Why does StartCoroutine say cannot convert from method group to string?
You passed the coroutine's name without brackets, so the compiler received the method itself. It reports the mismatch against the first overload of StartCoroutine, which takes a method name as a string. Write StartCoroutine(Fade()) so the method is called and its IEnumerator is passed.
How do I fix cannot convert from void to UnityEngine.Events.UnityAction?
Remove the brackets after the method name inside AddListener, as in button.onClick.AddListener(StartGame). With brackets the method runs immediately and its empty result is passed. To pass your own value, use a lambda such as () => LoadLevel(3).
Why can I not pass a Vector3 as the rotation in Instantiate?
The third parameter of Instantiate is a Quaternion, and Unity has no automatic conversion from a Vector3. Use Quaternion.identity for no rotation, another object's rotation property, or Quaternion.Euler to build one from three angles.
What does method group mean in a C# error?
It is the compiler's term for a method name written without brackets, which refers to the method itself and not to a value it returns. That is valid where a delegate such as UnityAction is expected. Anywhere else, either add the brackets to call the method or pass what the parameter really wants.
Count to the argument the message names, then compare what you passed with what the parameter wants. In Unity it is usually the owner of the value (a Transform, a GameObject, a method name) where the value itself was expected.