#Buttons don't receive click events.

1 messages · Page 1 of 1 (latest)

charred harbor
#

Is there an issue with using the UI Canvas?

#

Even this log does get called in the button.ts.

ember summit
#

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?

charred harbor
#

The UI is just not picking up any click events

ember summit
#

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)

charred harbor
#

Thank you. I have no idea what the issue was with the sandbox scene.

slender fossil
#

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?)

charred harbor
#

All raycast targets are on

slender fossil
#

Do you have any sort of raycaster in your scene? graphicrayfaster? Or objectraycaster?

charred harbor
#

Oh. Wait the game objects are blocking the ui canvas

#

Feels backwards

slender fossil
#

If its a worldcanvas they can

charred harbor
#

No it's an overlay canvas

charred harbor
charred harbor
# slender fossil If its a worldcanvas they can

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.

charred harbor
#

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.

charred harbor
ember summit
#

What do you exactly have in mind?

Are you asking how you can edit the sample?

Or how to edit a engine component?

charred harbor
# ember summit What do you exactly have in mind? Are you asking how you can edit the sample? ...

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;
    }
}
vocal ether
#

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.

crude herald
#

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.

slender fossil
#

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

slender fossil
#

This should be fixed in the next version 🙂