internal static GameObject InstantiateForAnimatorPreview(Object original)
{
if (original == null)
{
throw new ArgumentException("The prefab you want to instantiate is null.");
}
GameObject go = InstantiateRemoveAllNonAnimationComponents(original, Vector3.zero, Quaternion.identity) as GameObject;
go.name = go.name + "AnimatorPreview";
go.tag = "Untagged";
InitInstantiatedPreviewRecursive(go);
Animator[] componentsInChildren = go.GetComponentsInChildren<Animator>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
Animator animator = componentsInChildren[i];
animator.enabled = false;
animator.cullingMode = AnimatorCullingMode.AlwaysAnimate;
animator.logWarnings = false;
animator.fireEvents = false;
}
if (componentsInChildren.Length == 0)
{
Animator animator2 = go.AddComponent<Animator>();
animator2.enabled = false;
animator2.cullingMode = AnimatorCullingMode.AlwaysAnimate;
animator2.logWarnings = false;
animator2.fireEvents = false;
}
return go;
}