Roll-A-Ball Game issue. IDE0051 Message. Ball does not roll

Hello,
I am working through the 3D Beginner: Roll-A-Ball tutorial and at the Moving-the-Player tutorial segment the code editor for the PlayerController script flashes the message IDE0051: Private member ‘PlayerController.OnMove’ is unused and as a consequence the ball does not move as specified in the tutorial video. Attached is the function code and code editor message. Any assistance or guidance would be truly appreciated. Thanks sincerely.

James


Code editor messages don’t always apply in the context of Unity, particularly as it doesn’t always have awareness of what is going on in the editor as far as the inspector goes.

It’s also only a warning, and not an error. It doesn’t always mean something is wrong.

That said, are you sure you followed the tutorial correctly?

Thanks for the response. I followed the directions verbatim, and the code matches what is required. What troubles me is the occurrence of the message indicating that the OnMove function of the PlayerController script is unused which suggests to me that there may be an issue with the connection to the Unity Input System. Your thoughts? Attached is the script in the code editor which matches the tutorial code


and as you can see there are no issues found.

Again, not all warning are relevant in the context of Unity. Visual Studio has no concept of the PlayerInput component and that it may invoke methods without directly referencing them.

I followed the tutorial as far as setting up the plane, sphere, and the sphere’s components, including PlayerInput, and wrote the following code:

public class PlayerController : MonoBehaviour
{
	private void OnMove(InputValue inputValue)
	{
		Debug.Log("On Move");
	}
}

And as expected the log was added to the console, even though Visual Studio is showing me the warning. So I would double check that you followed the steps correctly, alongside using the same Unity version as the tutorial. You can use Debug.Log statements yourself to check whether the code is running yourself or not.

Thanks again for the assistance and info. After contemplating my dilemma, I surmised that input or lack thereof was the key. And turns out that when I switched to game mode, I did nothing to provide input to the game. I hit the arrow key and ball moved as it should have. I have now progressed to the point where I have walls, and the ball can now roll around and not fall off of the playing surface. Moving through the rest of the tutorial. Appreciate the assistance.

James