mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-01-31 02:32:53 +08:00
parent
3667dc319a
commit
ed84e22910
@ -46,6 +46,11 @@ namespace nadena.dev.modular_avatar.core.editor
|
||||
var oscale = xform.lossyScale;
|
||||
xform.localScale = new Vector3(oscale.x / pscale.x, oscale.y / pscale.y, oscale.z / pscale.z);
|
||||
|
||||
if (parent.transform.Find(target.gameObject.name) != null)
|
||||
{
|
||||
target.gameObject.name = target.gameObject.name + "$" + GUID.Generate();
|
||||
}
|
||||
|
||||
target.transform.SetParent(parent.transform, true);
|
||||
|
||||
retargeter.FixupAnimations();
|
||||
|
@ -1,5 +1,6 @@
|
||||
using modular_avatar_tests;
|
||||
using nadena.dev.modular_avatar.animation;
|
||||
using nadena.dev.modular_avatar.core;
|
||||
using nadena.dev.modular_avatar.core.editor;
|
||||
using NUnit.Framework;
|
||||
using UnityEngine.Animations;
|
||||
@ -61,4 +62,25 @@ public class WorldFixedObjectTest : TestBase
|
||||
Assert.That(nestedFixedObject, Is.Not.Null);
|
||||
Assert.That(nestedFixedObject, Is.EqualTo(nestedFixed));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void NameCollisions()
|
||||
{
|
||||
var avatar = CreateRoot("Avatar");
|
||||
var target1 = CreateChild(avatar, "Target");
|
||||
var target2 = CreateChild(avatar, "Target");
|
||||
|
||||
target1.AddComponent<ModularAvatarWorldFixedObject>();
|
||||
target2.AddComponent<ModularAvatarWorldFixedObject>();
|
||||
|
||||
// initialize context
|
||||
var buildContext = new BuildContext(avatar);
|
||||
var animationServices = buildContext.PluginBuildContext.ActivateExtensionContext<AnimationServicesContext>();
|
||||
|
||||
new WorldFixedObjectProcessor().Process(buildContext);
|
||||
|
||||
Assert.AreSame(target1.transform.parent, target2.transform.parent);
|
||||
Assert.AreNotSame(target1.transform.parent, avatar.transform);
|
||||
Assert.AreNotSame(target1.gameObject.name, target2.gameObject.name);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user