#Buttons don't receive click events.
1 messages · Page 1 of 1 (latest)
Hey 👋 since the engine is from a production NPM package, i'm usure if your changes are preserved.
Can you try adding the ?debugbutton to your url and see if the ballon message "CLICKED BUTTON" appears?
Click Button does not appear with debugbutton
The UI is just not picking up any click events
Can you open the ScreenSpaceUI sample and test that everything works there?
(You might click "install samples package" if you haven't done that already)
@charred harbor If that works, can you double check if there are any other components in your scene?
If that sample doesn't work, can you double check on what version you are on and maybe update the package? (Window/Package Manager)
So the sample scene works with the UI. I tried to add UI to the sandbox. I created a minimal scene and ui works.
Thank you. I have no idea what the issue was with the sandbox scene.
Can you check if any of the objects was maybe set to the IgnoreRaycast layer (or RaycastTarget was off in Unity? Or a Canvas group with interactable off?)
I can't find any difference between my working scene on a fresh minimal vs the default sanbox scene
All raycast targets are on
Do you have any sort of raycaster in your scene? graphicrayfaster? Or objectraycaster?
If its a worldcanvas they can
No it's an overlay canvas
Okay. So yeah 3d objects block screen space canvas.
I tested using the camera screen space and if you set the plane distance far enough it will be blocked by the 3d object for raycast only.
Okay. So its just he dragcontrols.ts that is causing issues. Since it using the onpointer ui events. Which are the same that the ui elements are listening to.
Okay. So this is a pretty cool project. How can make my changes preserved for any testing?
What do you exactly have in mind?
Are you asking how you can edit the sample?
Or how to edit a engine component?
so for instance in the raycaster.ts I wanted to uncomment the console.log, when I was trying to figure out this ui issue.
export class ObjectRaycaster extends Raycaster {
private targets: THREE.Object3D[] | null = null;
private raycastHits: THREE.Intersection[] = [];
start(): void {
this.targets = [this.gameObject];
}
performRaycast(opts: RaycastOptions | null = null): THREE.Intersection[] | null {
if (!this.targets) return null;
opts ??= new RaycastOptions();
opts.targets = this.targets;
opts.results = this.raycastHits;
const hits = this.context.physics.raycast(opts);
// console.log(this.context.alias, hits);
return hits;
}
}
You can do edits in the already compiled lib/.js files for testing/experimentation, but we're not generally supporting that workflow.
Source code access with support is an enterprise feature, since there are so many details regarding you modifying source and then wanting to update to later versions.
Typically you'll have your own components that you're editing. Since it's all Javascript you can also patch methods in the core if needed.
I'm having a similar issue in the project from the react repository in the needle-engine org, which I think has an identical scene to the Sandbox project. The button I've added can be highlighted, but not clicked. I've tried to set it up like the canvas UI sample project, except the using screen space instead of world space. I made sure to add a GraphicRaycaster to the canvas, and a StandAloneInputModule to the EventListener. I also deleted all the networking stuff outside of the Content GameObject to see if that would change anything. The one thing thats different from @charred harbor as far as I can tell is there's no DragCOntrols.ts script in the scene.
Hi, I'll take a look at this now
The problem is related to a large distance between near and farclip plane where the UI ends up behind the geometry (in the scene) - this is a bug in the UI system and I'll look further into it but just as a quick workaround would be (if possible) to reduce the farclip plane to a reasonable distance (by default it's 0.1 - 1000 in the sandbox scene which leads to this issue)
The problem doesnt exist with something like 0.1 - 30
This should be fixed in the next version 🙂