CMZTECH.NET
  • Blog
  • Graphics
  • Virtual Reality
  • 3D Printing
  • Fun Stuff
  • Contact

Unity UI Issues

2/17/2021

0 Comments

 
Unity UI has been giving me headaches. I suspect that I may just be using it completely wrong.  I have 5 canvases and I chose in script which is currently displayed.  The problem being that the ui elements don't really seem to like or respect being made inactive.
One isssue I had for ages was the caret (cursor) on an input field trying to update itself despite being marked as inactive.  This created a bizzilion warnings in the console which were just annoying at first... later I think there really was a big where that input field was getting input when it shouldn't have been.
Fixed that by marking the input field inactive 

 playerNameField.DeactivateInputField();
 playerNameField.enabled = false;

https://answers.unity.com/questions/867765/deactivate-input-field-not-set-interactable-to-fal.html


In the process of trying to fix that one, or maybe updating to a new version of the unity editor, somehow all my UI buttons got set to have "automatic" navigation.  This again meant they were stealing input and doing stuff when they shouldn't.  Particularly when Enter or Space was pressed.  Arrghhhhh. 

Found the solution in a 6 year old support ticket... 
https://answers.unity.com/questions/859460/button-is-being-triggered-by-spacebar-after-clicke.html


One good thing that came out of all this was I did find the rollout in the editor that lets you set the rules for an input field, so I can set that to alphanumeric and then get rid of the code I'm currently using to sanitize file names.

Anyway like I said, I suspect I'm trying to do something weird and I should have sat down and spent a week learning the UI system instead of assuming I could just lash something together using common sense.  Doh.



0 Comments



Leave a Reply.

    David Coombes

    Making stuff

    Categories

    All
    3D Graphics
    3D Printing
    3D Scanning
    AI
    Blender
    Cycling
    Development
    Environment
    Futurism

    Archives

    February 2023
    November 2022
    April 2022
    February 2022
    January 2022
    February 2021
    January 2021
    November 2020
    May 2020
    April 2020
    March 2020
    February 2020
    December 2019
    November 2019
    September 2019
    August 2019
    July 2019
    January 2019
    December 2018
    October 2018
    August 2018
    June 2018
    April 2018
    March 2018
    February 2018
    January 2018
    July 2017
    June 2017
    May 2017
    April 2017
    March 2017
    January 2017
    September 2016
    August 2016
    July 2016
    May 2016
    April 2016
    March 2016
    December 2015
    November 2015
    August 2015
    July 2015
    June 2015
    April 2015
    March 2015
    February 2015
    January 2015
    December 2014
    November 2014
    October 2014

    RSS Feed