The Y Axis is flipped. Moving an UI Image down moves it up in the build!
Exporting an Image with a position other than it’s anchor origin will reset the image to it’s anchor position in the build as soon as it’s moved in the editor. All movement is now relative from this position.
Activating and Deactivating Object under a Canvas results in Unknown object xxxxxxxxxxx in browser console and nothings happening. Activating and Deactivating Image Component seems the work though. I’m also seeing no change in the build when setting gameobject.visible via script on these objects.
Tested with Needle Engine 3.5.9-pre.2 and Unity 2021.3.17 as well as Unity 2022.2.18
Hi Podden, thanks for the info. UI is currently in the progress and it hasnt been tested with EditorSync yet. I will add those to our internal issues for testing
thanks, but got another one for you that is not Editor Sync related: Object3D variable as issues when a RectTransform is assigned:
@serializable(Object3D)
public testRectTransform?: Object3D = null || undefined;
public testfunc(): void {
if (this.testRectTransform) {
//This does not work when this.testRectTransform is a RectTransform
let test = GameObject.getComponent(this.testRectTransform, GameObject);
//This does not work either when this.testRectTransform is a RectTransform
this.testRectTransform.visible = false;
}
}
Don’t know maybe this is intended? I can’t assign a normal Transform on and Object3D, the Unity Editor is casting this to RectTransform right away.
RectTransforms are a bit special because they ARE a component at runtime and are exported, so you have to write:
@serializable(RectTransform)
public testRectTransform? RectTransform;
// and then
if(this.testRectTransform)
this.testRectTransform.gameObject.visible = false;
if you want the gameObject reference directly then your type in Unity has to be a GameObject (e.g. in C# would be public GameObject testRectTransform;)
Okay, just saw using newPanel : Object3Dgives me the same empty GUID object. This only happens on RectTransforms, Normal Transforms getting serialized normally
I just wrote a test class which I hooked to a UnityEvent on a UI Button. I’ve attached screenshots of the UnityEvent and the console result when clicked on. As you can see, the RectTransform is serialized wrong, the normal transform works as expected. Can I put @serializable on functions as well?
import { Behaviour, RectTransform } from "@needle-tools/engine";
import { Object3D } from "three";
export class NeedleUIManager extends Behaviour {
public setWelcomeTextRectTransform(newPanel? : RectTransform){
console.log(newPanel);
}
public setWelcomeText(newPanel?: Object3D) {
console.log(newPanel);
}
}