unity粒子转成cocoscreator3.7插件

ccc中好像是没有sortingOrder这个概念

Mark~

咋实现不了,可以给出一个demo吗

很好用,赞一个

convert直接报readFile错误

其实就是解析yaml文件,以前我就写国一个插件可以加载U引擎的场景文件到cocos2dx

有下载地址不

我自己项目用的不开源也不出售

mmmmmmmark

我修改了一下,原先如果unity的粒子特效中包含monobehavor和prefab的节点,转换就会失败,我增加了对这两个的支持就可以解析了

yaml文件里可能会有预制体的各种组件信息。我的这个里面只写了包括粒子组件的几个基本的解析。

复杂嵌套的粒子还有很多要完善的代码要写

求个下载链接

mark!

修复一个bug
/**

 * 调整组件数组顺序,确保 ParticleSystem 在 ParticleSystemRenderer 之前

 * @param cmps 组件数组

 * @returns 排序后的组件数组

 */

reorderComponents(cmps: any[]): any[] {

    const orderedCmps: any[] = []; // 创建一个新数组用于存储排序后的组件

    const particleSystems = cmps.filter(cmp => cmp.u3dType === "ParticleSystem");  // 先收集 ParticleSystem 组件

    const particleSystemRenderers = cmps.filter(cmp => cmp.u3dType === "ParticleSystemRenderer");   // 收集 ParticleSystemRenderer 组件

    // 收集其他所有组件

    const otherComponents = cmps.filter(cmp => cmp.u3dType !== "ParticleSystem" && cmp.u3dType !== "ParticleSystemRenderer");

    // 按顺序合并:先放其他组件,然后是 ParticleSystem,最后是 ParticleSystemRenderer

    // 这样确保了 ParticleSystem 在 ParticleSystemRenderer 之前

    // 如果 Transform 需要特殊处理,也可以在这里调整

    const transformComponents = otherComponents.filter(cmp => cmp.u3dType === "Transform");

    // 通常是 Transform 在最前面,然后是其他组件,接着是 ParticleSystem,最后是 ParticleSystemRenderer

    orderedCmps.push(...transformComponents);

    orderedCmps.push(...particleSystems);

    orderedCmps.push(...particleSystemRenderers);

    return orderedCmps;

}
2赞