#Editor Sync doesn't work on my project

1 messages · Page 1 of 1 (latest)

timid fox
#

Hello Needle,

I'm trying to use the Editor Sync component to improve the postprocessing of my scene.
But after install it and enable it (and save to reload the scene). I see no change when modify my postprocessing script value. (only more warnings)

Does somebody could help me ?

surreal furnace
#

do you see this log in the topright corner ?

timid fox
#

I don't think, but maybe it's hidden by the interface

#

Web side or unity side ?

surreal furnace
#

You might need to update your vite config to load the plugin.

export default defineConfig(async ({ command }) => {

    const { needlePlugins, useGzip, loadConfig } = await import("@needle-tools/engine/plugins/vite/index.js");
    const needleConfig = await loadConfig();
...
 plugins: [
            ...
            needlePlugins(command, needleConfig),
        ],
timid fox
#

I tried to add the const directly in the defineConfig in the vite.config.js but it generate erros so I done like this :

surreal furnace
#

you can do it inside with export default defineConfig(async ({ command }) => {

and returning the config in an object

return {
        base: "./",
....
#

like this:

export default defineConfig(async ({ command }) => {

    const { needlePlugins, useGzip, loadConfig } = await import("@needle-tools/engine/plugins/vite/index.js");
    const needleConfig = await loadConfig();

    return {
        base: "./",
        ...
timid fox
#
import * as path from 'path';
import { defineConfig, optimizeDeps } from 'vite';
import viteCompression from 'vite-plugin-compression';
import react from '@vitejs/plugin-react'


export default defineConfig(async ({ command }) => {

    const { needlePlugins, useGzip, loadConfig } = await import("@needle-tools/engine/plugins/vite/index.js")
    const needleConfig = await loadConfig()

    return {
        base: "./",
        // publicDir: "./assets", // this would copy all assets in the outdir (but not inside assets)
        assetsInclude: ['*'],
        // logLevel: 'info',

        plugins: [
        react(),
        needlePlugins(command, needleConfig),
        //viteCompression({ deleteOriginFile: true }),
        ],

        server: {
        // hmr: false,
        // watch: ["generated/**"]
        https: true,
        proxy: { // workaround: specifying a proxy skips HTTP2 which is currently problematic in Vite since it causes session memory timeouts.
            'https://localhost:3000': 'https://localhost:3000'
        },
        watch: {
            awaitWriteFinish: {
                stabilityThreshold: 500,
                pollInterval: 1000
            },
        },
        strictPort: true,
        },
        build: {
        outDir: "./dist",
        emptyOutDir: true,
        keepNames: true,
        },
        resolve: {
        alias: {
            'three': () => {
                const absPath = path.resolve(__dirname, 'node_modules/three');
                return absPath;
            },
            '@needle-tools/engine': () => {
                const absPath = path.resolve(__dirname, 'node_modules/@needle-tools/engine');
                return absPath;
            },
            'react': () => {
                const absPath = path.resolve(__dirname, 'node_modules/react');
                return absPath;
            }
        }
        }
        }
});
surreal furnace
#

which vite version are you using?

timid fox
#

2.6.4

surreal furnace
#

Ah ok, you need to update to ^3.1.4 then and also install "@vitejs/plugin-basic-ssl": "^0.1.2"

After that in vite.config import import basicSsl from '@vitejs/plugin-basic-ssl'

and also add the basicSsl plugin

plugins: [
            basicSsl(),
#

You can generate a project using our normal vite template as a reference

#

and look at vite.config and package.json

#

it's basically the same except that your project also has react installed

#

You can also find the template files in the package in Unity (in Core/Editor/Projects/Templates)

timid fox
#

Ok it reload correctly, I try the Editor Sync

#

The "It will reload in a moment" now appear

But the "Needle Editor has loaded" doesn't appear

#

Do I need to do something more about the Editor Sync ?

surreal furnace
#

Does the vite server terminal show any message? like this?

timid fox
#

Nop

surreal furnace
#

How does your vite config look like now? It looks like our plugin is not actually loaded

timid fox
#
import * as path from 'path';
import { defineConfig, optimizeDeps } from 'vite';
import viteCompression from 'vite-plugin-compression';
import basicSsl from '@vitejs/plugin-basic-ssl'
import react from '@vitejs/plugin-react'


export default defineConfig(async ({ command }) => {

    const { needlePlugins, useGzip, loadConfig } = await import("@needle-tools/engine/plugins/vite/index.js")
    const needleConfig = await loadConfig()

    return {
        base: "./",
        // publicDir: "./assets", // this would copy all assets in the outdir (but not inside assets)
        assetsInclude: ['*'],
        // logLevel: 'info',

        plugins: [
            react(),
            needlePlugins(command, needleConfig),
            basicSsl(),
            //viteCompression({ deleteOriginFile: true }),
        ],

        server: {
        // hmr: false,
        // watch: ["generated/**"]
        https: true,
        proxy: { // workaround: specifying a proxy skips HTTP2 which is currently problematic in Vite since it causes session memory timeouts.
            'https://localhost:3000': 'https://localhost:3000'
        },
        watch: {
            awaitWriteFinish: {
                stabilityThreshold: 500,
                pollInterval: 1000
            },
        },
        strictPort: true,
        },
        build: {
        outDir: "./dist",
        emptyOutDir: true,
        keepNames: true,
        },
        resolve: {
        alias: {
            'three': () => {
                const absPath = path.resolve(__dirname, 'node_modules/three');
                return absPath;
            },
            '@needle-tools/engine': () => {
                const absPath = path.resolve(__dirname, 'node_modules/@needle-tools/engine');
                return absPath;
            },
            'react': () => {
                const absPath = path.resolve(__dirname, 'node_modules/react');
                return absPath;
            }
        }
        }
        }
});
surreal furnace
#

will take a look now and update the template

#

Mmmh updated the vite config and versions in the react template and works with no other changes

surreal furnace
# timid fox

That error points to an super old engine version? 2.60.4 ?

#

Can you check you node_modules/@needle-tools/engine folder and the package.json in your project? What paths are entered there? Can you show that?

#

If 2.60. is installed it makes sense that it doesnt work

timid fox
#

I think you right... there is an error on the package gestiannary on unity

Here my package.json :

#

{
"name": "my-project",
"version": "1.0.0",
"scripts": {
"start": "vite --host",
"pre-build": "tsc",
"build:dev": "tsc && vite build && npm run copy-files",
"build:production": "npm run build:dev && npm run pack-gltf",
"serve": "vite preview",
"copy-files": "copy-files-from-to",
"pack-gltf": "npm run pack-gltf --prefix node_modules/@needle-tools/engine"
},
"dependencies": {
"@emotion/react": "^11.10.5",
"@emotion/styled": "^11.10.5",
"@mui/material": "^5.11.7",
"@needle-tools/engine": "file:../../Library/PackageCache/[email protected]/package~",
"@vitejs/plugin-basic-ssl": "^0.1.2",
"comlink": "^4.4.0",
"dat.gui": "^0.7.9",
"gsap": "^3.11.4",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"styled-components": "^5.3.6",
"three": "file:../../Library/PackageCache/[email protected]/package~/node_modules/three",
"three-bvh-csg": "^0.0.4",
"typestyle": "^2.4.0",
"unstated-next": "^1.1.0"
},
"devDependencies": {
"@gltf-transform/cli": "^2.1.7",
"@gltf-transform/functions": "^2.1.7",
"@needle-tools/editor-sync": "^1.0.0-pre",
"@types/three": "0.146.0",
"@vitejs/plugin-react": "^1.3.0",
"ansi-styles": "^6.1.0",
"copy-files-from-to": "^3.3.0",
"eslint-plugin-react-hooks": "^4.5.0",
"typescript": "^4.5.5",
"vite": "^3.1.4",
"vite-plugin-compression": "^0.3.6"
},
"copyFiles": [
{
"from": "assets//.",
"to": "dist/assets/"
},
{
"from": "node_modules/@needle-tools/engine/src/include/
/.",
"to": "dist/include/"
},
{
"from": "include/**/.",
"to": "dist/include/"
}
]
}

surreal furnace
timid fox
surreal furnace
#

Can you try removing the path (leave it empty) and run install again? (It should auto-fill the correct path

timid fox
#

Yep, I will, thanks

surreal furnace
#

I've seen this happen a few times when unity didnt delete the old folder (we only change local paths when they dont exist, usually unity should delete older package versions but sometimes that seems to fail)

It's actually one of the bigger changes coming to the next major update (no more local paths)

surreal furnace
#

Buuuut with the correct version it should work now too 🙂

timid fox
surreal furnace
#

That can happen if the npm install failed/stopped unexpectedly. Try doing a clean install maybe

timid fox
#

Is it normal that I need to remake the setup ?

#

It's not gonna erase a part of my code if I do that ?

surreal furnace
#

no

#

Did you have code erased in any version?

timid fox
#

I didn't run the setup installation during a project in developement from now, so I prefer asking (sorry aha)

surreal furnace
#

Makes sense, just asking because if that would happen it would be very bad 🙂

timid fox
#

Little detail : when I start the server
The url launched is not the same the the vite one

surreal furnace
#

that's because your vite config is missing a detail:

            strictPort: true,
            port: 3000,
#

It seemed to be missing from the template. I just noticed when I tried here

timid fox
#

The Editor sync seems not working again x) sorry :x

surreal furnace
#

🤔 any logs?

timid fox
surreal furnace
#

That's it?

timid fox
#

I will try to relaunch with unity and see its logs

#

Maybe this :

surreal furnace
#

Shouldnt be relevant 🤔

timid fox
#

And this

#

But my server works so it's strange

#

Otherwise it's only BVH peering with threejs version warning

surreal furnace
#

Can you try if it works if you create another project somewhere else from the current vite template and add the EditorSync?

timid fox
#

You want that I create a total new project with the react vite template ?

#

To test the EditorSync ?

surreal furnace
#

The react template is not yet updated, better try the vite template

timid fox
#

Hello,

I retry today with a new template (the vite one) and it works well.

surreal furnace
#

Nice

timid fox
#

I retried on my project with the version 2.67.13-pre

Now it works, well done guys

#

In fact, what's the list of the post processing which is implemented from unity to the Web ?

Because for example the post exposure works well, but the color curves doesn't