Obi Official Forum
Instanced Cloth Not Appear In Builds - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Cloth (https://obi.virtualmethodstudio.com/forum/forum-2.html)
+--- Thread: Instanced Cloth Not Appear In Builds (/thread-2764.html)



Instanced Cloth Not Appear In Builds - fluidman84 - 24-02-2021

Hello,

I have created a script that Instances a Cloth Prefab clothing item and parents it under the solver character during runtime. 

When I run the script system in the editor, everything behaves normally and the cloth is instantiated under the parent character and begins the cloth simulation as expected. However, when I deploy the same script in a Build, the clothing item does not appear in the scene when the I attempt to spawn the clothing item. 

I have run several tests with the skinned cloth renderer both included and removed, and it is confirmed that the issue appears when the instanced item includes the obi skinned cloth and renderer.

Can you direct me as to what might be the issue that my prefabs will not appear in compilled builds when instanced at runtime?

Code:
    public GameObject femModel;

    public GameObject thisClothing;
    public GameObject[] clothingItem;
    private bool clothingOn;

    public GameObject dressObject;


    // Start is called before the first frame update
    void Start()
    {

        //Load clothing meshes (Assets/Resources/clothing/G8F_NicoleAgent.fbx)
        clothingItem[0] = Resources.Load<GameObject>("clothingPrefabs/G8F_NicoleAgent");
        clothingItem[1] = Resources.Load<GameObject>("clothingPrefabs/Blender_LoRes_Mini Beach Dress");
        clothingItem[2] = Resources.Load<GameObject>("clothingPrefabs/G8F_Nightie_LoRes");
        clothingItem[3] = Resources.Load<GameObject>("clothingPrefabs/G8F_Vision_Bikini");
        clothingItem[4] = Resources.Load<GameObject>("clothingPrefabs/G8F_JoyUndies");
        clothingItem[5] = Resources.Load<GameObject>("clothingPrefabs/G8F_XFashionSweatshirt");
        clothingItem[6] = Resources.Load<GameObject>("clothingPrefabs/G8F_CowgirlOutfit");
        clothingItem[7] = Resources.Load<GameObject>("clothingPrefabs/G8F_TropicalDayBikini");
        clothingItem[8] = Resources.Load<GameObject>("clothingPrefabs/G8F_TropicalDayKimono");
        clothingItem[9] = Resources.Load<GameObject>("clothingPrefabs/G8F_DarkNurse");
        clothingItem[10] = Resources.Load<GameObject>("clothingPrefabs/G8F_HotTennisOutfit");
        clothingItem[11] = Resources.Load<GameObject>("clothingPrefabs/G8F_Pantyhose");
        clothingItem[12] = Resources.Load<GameObject>("clothingPrefabs/G8F_DeepNeckMiniDress");
        clothingItem[13] = Resources.Load<GameObject>("clothingPrefabs/G8F_BellaLingerie");
        clothingItem[14] = Resources.Load<GameObject>("clothingPrefabs/G8F_XFashionBohoChic02");
        clothingItem[15] = Resources.Load<GameObject>("clothingPrefabs/G8F_UnderwearG8F");
        clothingItem[16] = Resources.Load<GameObject>("clothingPrefabs/G8F_HotDress06");
        clothingItem[17] = Resources.Load<GameObject>("clothingPrefabs/G8F_NovemberDress");
        clothingItem[18] = Resources.Load<GameObject>("clothingPrefabs/G8F_XFashionCuteLingerie");
        clothingItem[19] = Resources.Load<GameObject>("clothingPrefabs/G8F_AnimeLingerieSet02");
        clothingItem[20] = Resources.Load<GameObject>("clothingPrefabs/G8F_Pubic");
        clothingItem[21] = Resources.Load<GameObject>("clothingPrefabs/G8F_RecreationalOutfit");
        clothingItem[22] = Resources.Load<GameObject>("clothingPrefabs/G8F_InfuseOutfit");
        clothingItem[23] = Resources.Load<GameObject>("clothingPrefabs/G8F_BikiniCoverup");
       
    }

    public void ChangeOutfit(int OutfitVal)
    {
        Destroy(thisClothing);

        thisClothing = Instantiate(clothingItem[OutfitVal]) as GameObject;
        thisClothing.transform.parent = femModel.transform;
    }

    public void SpawnDress(int OutfitVal)
    {
        thisClothing = Instantiate(dressObject) as GameObject;
        thisClothing.transform.parent = femModel.transform;
    }



RE: Instanced Cloth Not Appear In Builds - josemendez - 24-02-2021

Hi,

I'm unable to reproduce this in my tests. Obi does not handle prefabs in any specific way that could cause this to happen - they're just regular prefabs -. Would it be possible for you to share your project? If so, send it to support(at)virtualmethodstudio.com so I can take a look.


RE: Instanced Cloth Not Appear In Builds - fluidman84 - 25-02-2021

If I minimize the number of clothing assets in the Resources folder the prefabs are working fine. Looks like it's just a memory issue as the clothing objects are so big the runtime can't handle the memory heap. 

I'll find another solution for swapping objects with Asset Bundles and the like. Thanks for your assistance on this Jose!