Click here to Skip to main content
15,896,348 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I fix Error CS7036 There is no argument given that corresponds to the required formal parameter 'cat' of 'Record.Record(string, string) in Unity 2019.13.12f1 script editor

Thank you!

What I have tried:

Here is the code and error:

**public FixRecord()** < Line 63 (Here it is)
{
}
public FixRecord(string cat, string msg, FixMethodDelegate fix, UnityEngine.Object target, bool editRequired, string[] buttons)
: base(cat, msg)
{
buttonNames = buttons;
fixMethod = fix;
targetObject = target;
editModeRequired = editRequired;
complete = false;
}
}
Posted
Updated 5-May-20 0:24am

1 solution

I'm going to assume your FixRecord class inherits from a class that looks like

public class SomeBaseClass
{
    public SomeBaseClass(string cat, string msg)
    {

    }
}


If you create a class that inherits a class then you have to pass the relevant parameters to that base class's constructor (the two string variables). Your FixRecord has two constructors, one with multiple params and one with none. The one with multiple params calls the base class constructor properly (the ": base" code), but the one with no params doesn't.

How you fix this "depends". If you never want to create your class with no params;

var x = new FixRecord();


then simply remove the constructor that is causing the issue. If you do want to create your class with no params then you have to decide what default values are given to the base class constructor. So if this is to be an empty string then update the constructor like

public FixRecord() : base (string.Empty, string.Empty)
{

}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900