Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Does somebody know how to fix this??1!

Discussion in 'Scripting' started by hayriyansergey, Aug 27, 2020.

  1. hayriyansergey

    hayriyansergey

    Joined:
    Aug 27, 2020
    Posts:
    1
    I am learning the C# on Unity. After the first lesson I was given on the course, I am having this problem.

    {
    void Start()
    {
    myFunc();
    CS7036 C# There is no argument given that corresponds to the required formal parameter 'a' of ''Script.myFunc(int, int)'

    }

    void myFunc(int a, int b)
    {
    int res = a + b;
    print(res);
    }
    }

    I can't get what I am doing wrong,
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,336
    Your myFunc() function takes 2 integer arguments.

    You are not giving it 2 integers when you invoke it inside your Start() function.
     
    Joe-Censored likes this.
  3. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,735
    myFunc takes two parameters, and you aren't sending it any when you call it.
    (Note: use code tags, it makes your code more readable and easier to talk about - I could be using line numbers, etc and be more specific)
     
    Joe-Censored likes this.