-
-
Notifications
You must be signed in to change notification settings - Fork 219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using TextMeshPro #19
Comments
If there are compilation errors, please post them here. In any case, you'll have to edit the IngameDebugConsole prefab and replace that input field with TextMesh Pro's input field. Then, fix any missing references in the prefab's Inspector. |
There are no compilation errors, I have also changed the prefab, when I write something in the TMP_inputfield and I give it in, nothing happens |
I'm assuming that there are no runtime errors in the console either. DebugLogManager.OnValidateInput's |
Add a Debug.log to the condition Pd: There are no errors in the console nor any errors of execution. |
You can make the following additions to DebugLogManager.cs: public TMP_InputField commandInputField;
private bool moveInputFieldCaretToEnd;
private void OnEnable()
{
commandInputField.onSubmit.AddListener( OnSubmitCommand );
}
private void OnDisable()
{
commandInputField.onSubmit.RemoveListener( OnSubmitCommand );
}
private void OnSubmitCommand( string text )
{
// Clear the command field
if( clearCommandAfterExecution )
commandInputField.text = "";
if( text.Length > 0 )
{
if( commandHistory.Count == 0 || commandHistory[commandHistory.Count - 1] != text )
commandHistory.Add( text );
commandHistoryIndex = -1;
// Execute the command
DebugLogConsole.ExecuteCommand( text );
// Snap to bottom and select the latest entry
SetSnapToBottom( true );
}
commandInputField.ActivateInputField();
moveInputFieldCaretToEnd = true;
}
private void LateUpdate()
{
if( moveInputFieldCaretToEnd )
{
commandInputField.MoveTextEnd( true );
moveInputFieldCaretToEnd = false;
}
} |
Thank you very much, you are the best! |
How could I use textmeshpro in the input field?
Try replacing this
private InputField commandInputField;
to thisprivate TMP_InputField commandInputField;
But it doesn't work when I try to use some command
i Use "using TMPro;" and I also put the "TMP_inputfield" in the hierarchy
The text was updated successfully, but these errors were encountered: