Hi! I was experimenting with a Nuxt integration, itâs working quite well, but I found myself in a bit of a dilema:
I changed the output from the editor to a folder called ´unityIntegration´ (to avoid confusion with some namings, mainly Needle´s output folders from predefined Nuxt Folders). So my ´needle.config.json´ looks like this:
{
âbaseUrlâ: âneedleâ,
âbuildDirectoryâ: âpublic/needleâ,
âassetsDirectoryâ: âunityIntegrationâ,
âscriptsDirectoryâ: âsrc/scriptsâ,
âcodegenDirectoryâ: âsrc/generatedâ
}
When executing the Build everything works fine, but I noticed that during development, HMR doesnât work for static assets, i understand that this is because i changed ´buildDirectory´ to be ´public/needle´ (public being the folder where Nuxt serves static assets to be picked by Nitro), I cannot set the build directory to be ´public/needle/assets´ (which was my original idea) because at some point, a clearing process happens and references get lost between export and build.
Hence the separation, but now i need to âmanuallyâ copy the contents of the integration to where i need it, so that the devserver can pick it and trigger an update.
I tried setting up a watcher that triggers events when a file changes on the ´unityIntegration´ folder, but this triggers once per each file during scene export, so i discarded the idea.
Last Friday I asked on Discord About it, and you guys pointed me out to another post about: âmaterial export blending mode supportâ and also this fragment:
using Needle.Engine.Core;
using UnityEngine;
public static class NeedleEngineExportListener
{
private static void Init()
{
Builder.BuildStarting += () => Debug.Log(âBUILD STARTEDâ);
Builder.BuildEnded += () => Debug.Log(âBUILD ENDEDâ);
Builder.BuildFailed += () => Debug.Log(âBUILD FAILEDâ);
}
}
I tried the last one, but couldnt make it work, not sure if i´m doing something wrong, or is it Unity the one tricking me.
My objective is to execute a function inside a script immediately after scene export is completely finished (basically to synchronously copy/paste the contents to where i need it), not when building the final project. In other words, right after the process that happens when saving the scene with some changes.
Is this possible? and if the last fragment above is the way to achieve that, could you guys give me a step by step instruction? If i´m not mistaken, this should be an Editor extension right? I created an ´Assembly definition Reference´ asset to be able to use the ´Needle.Engine.Core´ namespace, the code compiles, but i don´t see it being executed. Did I miss something?