mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-05-23 03:16:57 +08:00
fix: issues with build failures when there are duplicate object paths (#398)
This commit is contained in:
parent
5a5142bf62
commit
0335c31725
@ -0,0 +1,21 @@
|
|||||||
|
using modular_avatar_tests;
|
||||||
|
using nadena.dev.modular_avatar.core.editor;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace _ModularAvatar.EditModeTests
|
||||||
|
{
|
||||||
|
public class DuplicateObjectNameTest : TestBase
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void test_duplicate_object_names()
|
||||||
|
{
|
||||||
|
var avatar = CreateRoot("root");
|
||||||
|
var c1 = CreateChild(avatar, "child");
|
||||||
|
var c2 = CreateChild(avatar, "child");
|
||||||
|
|
||||||
|
PathMappings.Init(avatar);
|
||||||
|
c2.gameObject.name = "child2";
|
||||||
|
Assert.AreEqual(PathMappings.MapPath("child"), "child");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 3ef07dec7e1d439586f2b925d89483b8
|
||||||
|
timeCreated: 1692505855
|
@ -25,6 +25,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using Serilog.Sinks.File;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using VRC.SDKBase.Editor.BuildPipeline;
|
using VRC.SDKBase.Editor.BuildPipeline;
|
||||||
@ -150,7 +151,7 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
{
|
{
|
||||||
if (cache != null) return cache;
|
if (cache != null) return cache;
|
||||||
|
|
||||||
ImmutableDictionary<string, string>.Builder builder = ImmutableDictionary.CreateBuilder<string, string>();
|
ImmutableDictionary<string, string> dict = ImmutableDictionary<string, string>.Empty;
|
||||||
|
|
||||||
foreach (var kvp in _objectToOriginalPaths)
|
foreach (var kvp in _objectToOriginalPaths)
|
||||||
{
|
{
|
||||||
@ -168,11 +169,14 @@ namespace nadena.dev.modular_avatar.core.editor
|
|||||||
var newPath = RuntimeUtil.AvatarRootPath(obj);
|
var newPath = RuntimeUtil.AvatarRootPath(obj);
|
||||||
foreach (var origPath in paths)
|
foreach (var origPath in paths)
|
||||||
{
|
{
|
||||||
builder.Add(origPath, newPath);
|
if (!dict.ContainsKey(origPath))
|
||||||
|
{
|
||||||
|
dict = dict.Add(origPath, newPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cache = builder.ToImmutableDictionary();
|
cache = dict;
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user