[SOLVED] Unexpected end of input

i have an issue with the code i looked at scripting and i think i did it correct.

pc.script.create('PickerRaycast', function (app) {
        // Creates a new PickerRaycast instance
        var PickerRaycast = function (entity) {
            this.entity = entity;
        PickerRaycast.prototype = {
            // Called once after all resources are loaded and before the first update
            initialize: function () {
                app.mouse.on(pc.EVENT_MOUSEDOWN, this.onSelect, this);
            onSelect: function (e) {
                var from = this.entity.camera.screenToWorld(e.x, e.y, this.entity.camera.nearClip);
                var to = this.entity.camera.screenToWorld(e.x, e.y, this.entity.camera.farClip);
                app.systems.rigidbody.raycastFirst(from, to, function (result) {
                    console.log("Entity picked is: " + result.entity.name);

is one } missing at the end?

1 Like

no i dont think one is

Iā€™m not familiar with your way of scripting, but on the page below you can find a similar script.


1 Like

still gives me the same error

Maybe because your old script is still in the project or something else is causing the error.

i made a new script and it ended up with the same error

Can you share a link of your project so someone can take a look?


As far as I can see you are missing }; at the end of your script. Probably the same mistake as before.


22 posts were split to a new topic: How to console log what item I picked from the center of the camera