anarkila / DeveloperConsole

Developer Console for Unity
MIT License
36 stars 1 forks source link

Pressing TAB to autofill a command doesn't place the cursor at the end #7

Closed ndumais closed 1 year ago

ndumais commented 1 year ago

This is a bit of a weird one, cause looking at the code, it seems like you already put in something for that. I tried fixing it without luck, adding a long enough delay seems to do something, but there's definitely something I don't get.

If you autofill a command pressing tab the cursor will stay in the same position, example:

image

image

This is a bit annoying since the expected behavior would be to be able to type arguments right away, not sure if there should be a space automatically added at the end also, probably not needed, but I'm not sure what's the expected behaviour there. Thanks as always!

anarkila commented 1 year ago

This is weird because this should work. Which Unity version are you using?

ndumais commented 1 year ago

This is weird because this should work. Which Unity version are you using?

Using 2020.3.32f1 here. Don't think I've witnessed it working on that version, I assume it's working for you?

anarkila commented 1 year ago

I wasn't able to replicate this issue with Unity 2019.3.16f1, 2020.3.42f1 or 2021.3.12f1 versions. Does this happen with every command you try? Does this happen in every scene and in the example scenes?

ndumais commented 1 year ago

Just tested opening the project, from the dev branch to test outside of my context, but it seems like the prefab is broken, scripts are no longer linked somehow.

image

Also, the issue is when you press Tab (autofill), but everything works fine with previous command (arrowup).

anarkila commented 1 year ago

Oops, I had not committed Unity .meta files which leads to missing references. This is now fixed. Both main and dev branches should now work properly if you clone the project and open it with Unity.

ndumais commented 1 year ago

Does seem to work on 2020.3.32f1 with the test scene. Might do some more testing at some point, I have a feeling it might have to do with frames, which could explain why it only happens in a bigger project. Note that SceneA (and also probably B and C) still have an Event System which makes it print a warning in console (since there are two in the scenes with the prefab fix).

On another note, check closed issue #6, seems like there's something wrong with it.

anarkila commented 1 year ago

I removed the EventSystem component from DeveloperConsole.prefab and instead added editor (OnValidate) check whether scene has EventSystem or not. If EventSystem component does not exists, then new GameObject is created and the component is added to it https://github.com/anarkila/DeveloperConsole/commit/ebc7e985aaf5dd8af8a5c18d575ac0cbd5f2ead0

anarkila commented 1 year ago

Does seem to work on 2020.3.32f1 with the test scene. Might do some more testing at some point, I have a feeling it might have to do with frames, which could explain why it only happens in a bigger project.

I found few posts on Unity forums that have similar issue but the threads were years old. However I found out there is actually another way of moving carePosition to end, using InputField.MoveTextEnd method.

I changed the code to use this method. Commit in the dev branch https://github.com/anarkila/DeveloperConsole/commit/764b06d3b42a0bdd0ee42a6005c1f13180b1aceb. Can you test it on your project?

ndumais commented 1 year ago

Hey, sorry was sick the past 3 days so took a bit of time to test it and follow up, but it seems like this method works better for some reason. I don't see any issues with that method, issue is seemingly fixed!

Also I don't think you get notifications when I post on closed issues right? Updated issue #6 again!

anarkila commented 1 year ago

Also I don't think you get notifications when I post on closed issues right? Updated issue https://github.com/anarkila/DeveloperConsole/issues/6 again!

I didn't receive notification for this. I'm going to look this a bit later.

That's great to hear this issue is now fixed. This seems like some sort of Unity bug but since I couldn't reproduce it myself, I can't make bug report. I'm going to close this issue. Thanks for your testing!