How to restrict movement using a character controller during an interaction.

I’m just working on a way to get some back and forth conversation between two characters. The idea that once you press a button, currently E, dialogue boxes pop up. Next, I would like to not allow the player freedom to move during this conversation.

I’m currently using something like this:
CharacterController cc = player.GetComponent();
cc.enabled = false;

Unity is throwing out lots of warnings my way during this period, so I was curious if it’s actually the “correct” way of implementing this, or if there might be something better.

The warnings will be because you are still sending commands to a disabled controller.
You could try using Input.ResetInputAxes() every frame while the conversation is open, but this may cause problems with selecting options for the dialogue.

Alternatively you could have a boolean for the controller and if it is true don’t process movement as moha suggested.