Пример #1
0
        private SkinnedMeshRenderer MakeRenderer(int i, Transform rootBone, UMARendererAsset rendererAsset = null)
        {
            GameObject newSMRGO = new GameObject(i == 0 ? "UMARenderer" : ("UMARenderer " + i));

            newSMRGO.transform.parent        = umaData.transform;
            newSMRGO.transform.localPosition = Vector3.zero;
            newSMRGO.transform.localRotation = Quaternion.Euler(0, 0, 0f);
            newSMRGO.transform.localScale    = Vector3.one;
            newSMRGO.gameObject.layer        = umaData.gameObject.layer;

            var newRenderer = newSMRGO.AddComponent <SkinnedMeshRenderer>();

            newRenderer.enabled    = false;
            newRenderer.sharedMesh = new Mesh();
#if UMA_32BITBUFFERS
            newRenderer.sharedMesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
#endif
            newRenderer.rootBone        = rootBone;
            newRenderer.quality         = SkinQuality.Bone4;
            newRenderer.sharedMesh.name = i == 0 ? "UMAMesh" : ("UMAMesh " + i);

            if (rendererAsset != null)
            {
                rendererAsset.ApplySettingsToRenderer(newRenderer);
            }

            return(newRenderer);
        }