needle-engine-support icon indicating copy to clipboard operation
needle-engine-support copied to clipboard

Transform with rect transform parent in UI Canvas is offsetted (since Needle exporter 3.3.0)

Open pkirsten opened this issue 2 years ago • 0 comments

Describe the bug šŸ’¬

I have a quad mesh nested under a rect transform parent in a UI canvas next to other UI elements. The position is displayed correctly in the Unity editor but gets a offset in the web export of Needle. This transform hierarchy worked fine until the needle update 3.3.0 with improved RectTransform support.

Operating System šŸ‘©ā€šŸ’»

Windows

What browsers are you seeing the problem on? šŸ„ā€ā™‚ļø

Chrome

Editor Version šŸŽ²

2021.3

Needle Exporter version

3.6.10

Project Info (Unity only) šŸ“œ

{
  "ExportInfoGameObjectName": "Export",
  "ExportInfoGameObjectIsEnabled": true,
  "UnityProjectPath": "F:/Git/ukhalle-digivid/development/Digivid/Assets",
  "UnityVersion": "2021.3.15f1",
  "SceneName": "UI-Transform-Bug",
  "ProjectPath": "Needle/UI-Transform-Bug",
  "ProjectDirectoryExists": true,
  "ProjectIsInstalled": true,
  "NeedleEngineInstalled": true,
  "HasNodeInstalled": true,
  "NodeVersion": "v16.18.0",
  "NpmVersion": "8.19.2",
  "TypescriptVersion": "'\u0000t\u0000s\u0000c\u0000'\u0000 \u0000i\u0000s\u0000 \u0000n\u0000o\u0000t\u0000 \u0000r\u0000e\u0000c\u0000o\u0000g\u0000n\u0000i\u0000z\u0000e\u0000d\u0000 \u0000a\u0000s\u0000 \u0000a\u0000n\u0000 \u0000i\u0000n\u0000t\u0000e\u0000r\u0000n\u0000a\u0000l\u0000 \u0000o\u0000r\u0000 \u0000e\u0000x\u0000t\u0000e\u0000r\u0000n\u0000a\u0000l\u0000 \u0000c\u0000o\u0000m\u0000m\u0000a\u0000n\u0000d\u0000,\u0000; \u0000; \u0000o\u0000p\u0000e\u0000r\u0000a\u0000b\u0000l\u0000e\u0000 \u0000p\u0000r\u0000o\u0000g\u0000r\u0000a\u0000m\u0000 \u0000o\u0000r\u0000 \u0000b\u0000a\u0000t\u0000c\u0000h\u0000 \u0000f\u0000i\u0000l\u0000e\u0000.\u0000; \u0000; \u0000",
  "HasTokTxInstalled": true,
  "HasMinimumToktxVersionInstalled": true,
  "RenderPipeline": "URP-HighFidelity (UnityEngine.Rendering.Universal.UniversalRenderPipelineAsset)",
  "GzipEnabled": false,
  "NeedleEngineExporterVersion": "3.6.10",
  "NeedleEngineVersion": "3.6.10",
  "NeedleEngineExporterPath": "Packages/com.needle.engine-exporter/package.json",
  "NeedleEnginePath": "F:/Git/ukhalle-digivid/development/Digivid/Assets/../Needle/UI-Transform-Bug/node_modules/@needle-tools/engine/package.json",
  "FileStats": "By Type:\r\n•\t.json →  x 8 = 0.4 mb\r\n•\t.png →  x 8 = 0.8 mb\r\n•\t.mp3 →  x 2 = 0.1 mb\r\n•\t.glb →  x 1 = 0.1 mb\r\n•\t<b>Total = 1.3 mb</b>\r\n----\r\nBy Directory:\r\n•\tassets →  x 19 = 1.3 mb\r\n",
  "NeedleComponentsInScene": [
    "Needle.Engine.ExportInfo",
    "Needle.Engine.Codegen.ComponentGenerator",
    "Needle.Engine.Deployment.DeployToGlitch",
    "Needle.Engine.Components.GltfObject",
    "Needle.Engine.Components.ObjectRaycaster",
    "Needle.Engine.Components.WebARSessionRoot",
    "Needle.Engine.Components.WebXR",
    "Needle.Engine.Components.OrbitControls",
    "Needle.Engine.Components.GridHelper",
    "Needle.Engine.Components.AxesHelper"
  ],
  "TypeCacheIsDirty": false,
  "TypeScriptTypes": []
}

Steps to reproduce šŸ”¢

1.Create a minimal scene with needle exporter 3.3.0 or higher
2.Create a Canvas with a cube and an UI image in it
3.Nest cube and image under a parent (Rect Transform by default)
4.Move the parent out of world origin.
5.Compare position of the cube in Unity Editor and Needle Web Export
6.Change the Rect Transform of the parent into a Transform - the cube gets now placed correctly but the UI image with its Rect Transform is offsetted.

See also sample scene attached.

Reproduction ā™»

20230614-192904-chrome image

UI-Transform-Bug.zip

Discord or Discussion link

https://prefrontalcortex.slack.com/archives/C03SCU2KF7B/p1684173720122769?thread_ts=1683907384.631879&cid=C03SCU2KF7B

Validations 🩹

pkirsten avatar Jun 14 '23 17:06 pkirsten