Debug.Log(); question.

i have a a bool function:

public bool Jump()
	{
		if (m_Controller.isGrounded)
		{
			m_MotorThrottle += new Vector3(0, MotorJumpForce, 0);
			return true;
		}
		else
		{
			return false;
		}
	}

and im trying to check whether it is true or not with Debug.Log(Jump()); but every time Debug log is called it causes the Jump function to run. and i don’t know how to use print. Will print cause the same issue?

You certainly can call Debug.Log on functions, for example, Debug.Log(Mathf.magnitude(p1-p2)); or your own: Debug.Log(nearestEnemy())'. Nothing wrong with that.

In formal terms, Jump has a side-effect. It figures out if you can jump and makes you jump. So, of course calling it jumps you. Formal programming says to split into bool canJump() and void doJump(). For longer stuff, that can sometimes help avoid confusion – is the function computing numbers for me, or doing something?