umi icon indicating copy to clipboard operation
umi copied to clipboard

UMI does not work when setting object inactive in Start()

Open trackme518 opened this issue 9 months ago • 5 comments

I am using UMI in my project. At some place it works and other it does not. I literally copied the whole gameobject with Text input field and attached UMI script, place it higher in UI elements hierarchy and it works. While inside other element it does not work. Worse, I can not see what is the difference as inside other element it is working. I am not sure if this is some problem with some cached behavior or what gives.

In green where it works, in red where it does not. Unfortunetely I can not find a difference - ie why it behaves like this.

Image

trackme518 avatar Mar 23 '25 18:03 trackme518

I traced it down to my script attached to the container. Here is the culprit:

 public void Start(){
        //Close(); //close settings panel at the start -> this caused the UMI to NOT work
    }
  
  public void Close(){
        gameObject.SetActive(false);
}

It is very strange - when I manually mark the object in the editor not active and later open it with another button, the UMI still works. When I make the object inactive inside Start() function in the script attached to the object, it does not.

trackme518 avatar Mar 23 '25 18:03 trackme518

It looks like UMI starts initialization and doesn't complete it because you are disabling the component at Start.

mopsicus avatar Mar 24 '25 10:03 mopsicus

The problem is that initialization here happens in the coroutine. If you turn it off at startup, the coroutine will turn off and there may be problems when trying again. Is it possible to make initialization not tied to monobeh or in some separate service?

tibettokitsune avatar Jul 17 '25 16:07 tibettokitsune

Is it possible to make initialization not tied to monobeh or in some separate service?

It is unlikely that this is possible. UMI waits for the TMP component to be created, gets its size and creates native fields.

mopsicus avatar Jul 24 '25 09:07 mopsicus

Yes, but when you turn it off before initialization, this process now breaks. It looks like by design, if initialization is interrupted, when you turn it on again, it should repeat the initialization attempt, but now it just stops working

tibettokitsune avatar Jul 28 '25 11:07 tibettokitsune