#UI that is under a disabled gameobject won't display when that gameobject is set active
1 messages · Page 1 of 1 (latest)
Hi Rob, this would indeed be an old issue being back. Do no UI objects show when you set them active at runtime or just some (e.g. just the text ? )
It does not reproduce here right now. Can you check if your object reference is correct? Codegen for UI objects being referenced might now be exported as RectTransform references. This would be a bug in the codegen (previously all Transform references were exported as Object3D references but UI is now a special case where we actually have a RectTransform component type)
This is my test script
export class ActivateObject extends Behaviour {
@serializable(RectTransform)
obj?: RectTransform;
async start() {
await delay(1000);
if (this.obj?.gameObject)
this.obj!.gameObject.visible = true;
console.log(this.obj);
}
}
I have changed that in a new component compiler where it will now generate a GameObject field instead of a Transform field when you write obj : Object3D in typescript. That's possibly a breaking change tho when scripts are being regenerated... I'm not sure if we should keep it or roll it back. But otherwise it would not be possible to know for sure what type is expected on export in Unity. So the change is the right one to make I think
Sorry was off on a bank holiday weekend here for a short while, I will get this tested out today