Esempio n. 1
0
    public static List <GameObject> SpawnSkinnedMeshToUnit(GameObject target_unit, GameObject head, GameObject suit)
    {
        Transform target_skeleton_root = target_unit.transform.FindDeepChild("humanoid");

        List <SkinnedMeshRenderer> suitobjects = suit.GetComponentsInChildren <SkinnedMeshRenderer>().ToList();

        suitobjects.AddRange(head.GetComponentsInChildren <SkinnedMeshRenderer>());

        List <GameObject> skinned_objects = M_Math.InsantiateObjects(suitobjects.Select(skn => skn.gameObject).ToList());


        skinned_objects.ForEach(obj => SkinnedMeshTools.AddSkinnedMeshTo(obj.gameObject, target_skeleton_root));
        //  MDebug.Log("spawn skinned " + skinned_objects.Count);
        return(skinned_objects);
    }