Editor Sync doesn't work on my project

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 ?


Original Post on Discord

by user 224464722878005248

do you see this log in the topright corner ?
image.png

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

by user 224464722878005248

Web side or unity side ?

by user 224464722878005248

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),
        ],

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

by user 224464722878005248

by user 224464722878005248

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: "./",
        ...
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;
            }
        }
        }
        }
});

by user 224464722878005248

by user 224464722878005248

which vite version are you using?

2.6.4

by user 224464722878005248

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)

Ok it reload correctly, I try the Editor Sync

by user 224464722878005248

The “It will reload in a moment” now appear

But the “Needle Editor has loaded” doesn’t appear

by user 224464722878005248