- Home /
Hide cursor in InputField (4.6 UI)
I'm having some problem with the InputField in the new Unity 4.6. When i deactivate the gameobject, the cursor will not go away. I have tried to hide it by changing the color of it, but it wont work either. Try it your self, create a InputField, press play, select it for typing and deactivate it in the hierarchy. The cursor will stay visible (it does for me at least).
So anyone have any idea how to fix it?
Just use Screen.showCursor? http://docs.unity3d.com/ScriptReference/Screen-showCursor.html
No, not the mouse cursor, the cursor that shows where you editor your string.
in my case that | sign disappear as ecpected after i click somewhere, can u tell which version of Unity you are using? 4.6.x?
I have the same issue. Setting focus to null via SetSelectedGameObject doesn't help
Interested in a solution as I too have experienced this. I did some research a couple weeks ago and mostly found similar problems, but no answers.
Answer by Mockarutan · Feb 18, 2015 at 11:44 AM
So I solved it some time ago. The solution I found is to make the Input field non intractable without deactivating the GameObject or the Component. Then I deactivate all the different component that makes it visible, like the background image and text that holds what you input.
It's obviously not a clean solution, but i have tried everything. Just to spare you some time and not try this yourself. I tried rebuilding the UI DLLs with an added function that clears the vertex buffer that draws the cursor. That did not work because Unity want vertex buffer operations to happen in a special rendering stage during the frame. So when called out of order, you get an exception and nothing happens.
So hope that helps :)
Can you please post the code of your workaround? I have the same problem, but couldn't get it working here.
Answer by EpicPandaGamer25 · Oct 03, 2015 at 02:38 PM
I fixed it using this code:
public InputField nametextbox;
public GameObject textbox;
public GameObject ok;
public GameObject text;
public GameObject placeholder;
public void SetName (string name) {
PhotonNetwork.playerName = name;
textbox.GetComponent<Image>().enabled = false;
nametextbox.interactable = false;
ok.SetActive (false);
text.SetActive (false);
placeholder.SetActive (false);
Multiplayer ();
}
Your answer
Follow this Question
Related Questions
InputField "bug" editing text before last symbol 2 Answers
How to use onValidateInput in JavaScript? 1 Answer
Caret Position in InputField for android device 0 Answers
How to save InputField value? 1 Answer
Missing Input Field Cursor on Web Player 2 Answers