Debug.Log does not show up in console.

So, I have this very weird problem with my code:

When I put my Debug.Log after the if block, it doesn’t show up.

public Vector3 GetLeft(Vector3 initialPos)
	{
        Debug.Log("asd"); // It does show up in the console.
        if (lanes[Mathf.Clamp(currentLane - 1, 0, lanes.Count)].Enabled)
        {
            currentLane = Mathf.Clamp(currentLane - 1, 0, lanes.Count);
            currentEggPosition = new Vector3(lanes[currentLane].GetMiddle().x, eggPosition.y, eggPosition.z);
            return new Vector3(lanes[currentLane].GetMiddle().x, eggPosition.y, eggPosition.z);
        }
             Debug.LogFormat("asd"); // It doesn't show up in the console.
            return new Vector3(lanes[currentLane].GetMiddle().x, eggPosition.y, eggPosition.z);
    }

Useful info:
-the class does not extend MonoBheaviour
-it is Initialized in another class attached to an gameobject.

Is it a bug? Or am I missing something in the code?

It may be that your function GetLeft is not called at all.

Maybe this code:

if (lanes[Mathf.Clamp(currentLane - 1, 0, lanes.Count)].Enabled)

always evaluates to true so you end up always returning before you get to the second debug.

Try putting a debug here to check if that’s what’s happening

if (lanes[Mathf.Clamp(currentLane - 1, 0, lanes.Count)].Enabled)
{
    currentLane = Mathf.Clamp(currentLane - 1, 0, lanes.Count);
    currentEggPosition = new Vector3(lanes[currentLane].GetMiddle().x, eggPosition.y, eggPosition.z);
    Debug.Log("TEST DEBUG HERE");
    return new Vector3(lanes[currentLane].GetMiddle().x, eggPosition.y, eggPosition.z);
}

The second Debug.Log will never be called if the above “if statement” is always true, because you return the value and inmediately exits the function. Just place the Debug statement just before returning a value