I'm getting error "No overload for method 'Log', takes 3 arguments"

Okay, first off, I am a complete noob when it comes to coding. Don’t get surprised that I literally know nothing, my code’s probably horrible but oh well. Now that’s out of the way, I’m getting this error, “No overload for method ‘Log’, takes 3 arguments.” Here is the problem code:

class People {
        int strength;
        int stamina;
        int compassion;
        //i dont want the integers shown so dont ask
        string name;
        string mORf;
        public void Info(){
        //debug log was just to test if my code worked so its not 100% useful   
Debug.Log("Name:{0} Male or Female:{1}", name, mORf);
        }
//there is more code, but this is the only bit causing trouble

I don’t want to know there’s a more graceful way of doing this and I don’t want to know the problem’s obvious. It’s not, at least, not to me. Tell me how to fix it and that’s it.

If you are using unity 5.6 i suggest getting 5.5 because 5.6 has a few glitches but
Make sure everything is spelled right with small and big letters.

I do not believe that you can use arguments in Debug.Log
Debug.Log(string.Format // etc might work
but there is this for sure: Unity - Scripting API: Debug.LogFormat

This is much more intuitive anyway

Debug.Log("Name:" + name + " Male or Female:" + mORf);
2 Likes

Yes, that’s very true, but he might want to format it the other way. Good point, though :slight_smile:

You’re looking for Debug.LogFormat:

Debug.LogFormat("Name:{0} Male or Female:{1}", name, mORf));
2 Likes