Hi,

i like to ask if there is any direct way to load interiordesign only without floormap? I am building something similar to Decentraland, the part on runtime edit has been done, now coming to loading part.
I have a large map of land prefab 9000 pcs that i have turn to json file following homedesigner format(Outside), so runtime edit for each land has been done and working good.
Come to loading part, it creates large size of CG alloc when loading few homereader at once which stall the webgl a while. I have set correctly the transform position of the homereader to match my existing land prefab, all i want from homereader is just the modulescontainer. are there any way to produce modulescontainer only without floormap(proceduralroom, proceduralbuilding and openingcontainer)?

tq

    michaellu88 Hi!

    There is no option for that at the moment but you can manage to do so by making a subclass of HomeReader

    Basically instead of deserializing (and building) the floor map with this line:

    List<FloorController> fcs = (List<FloorController>)fmr.DeserializeToScene(currentFloorMapFile, -1);

    You would create or get the reference of your own container, then place it

    DeserializeInterior(level, YOUR_OWN_CONTAINER);

    Then change this:

    void DeserializeInterior(InteriorLevel level, FloorController fc)

    by

    void DeserializeInterior(InteriorLevel level, Transform modulesContainer)

    and this

    lc.CreateObj(so, true, false, fc.modulesContainer);

    by this

    lc.CreateObj(so, true, false, modulesContainer);

    Basically you want to call HomeReaser->DeserializeInterior(InteriorLevel level, FloorController fc);
    passing the deserialized interior json and replacing the second arg by a target transform object to load the interior objects in.

    By the way for webgl, creating hundreds of building at runtime is not recommended indead. I would build them as the user moves in the map, or prebake them during the loading screen.

      Anthony
      hi Anthony,

      thanks for prompt reply, follow your instruction it is working. I am loading the prefab and the homereader according to player distance which only load and unload up to 7 or 8 homereader at once.

      But it still stall webgl a while like 5 to 6 seconds to load, i suspect on json deserialised. may i ask how the json work?
      is exoa.Json same as newtonsoft.Json?

      tq

        michaellu88 Hi!
        Yes Exoa.Json is the same as NewtonSoft Json, I just had to change the namespace to have plugin setup smoothly on any Unity version (long story short).

        Deserializing the json into an object should not take long, but creating meshes could be long if you're still generating the floor maps, and your building are complex. Did you look at the Debugger window to find what's taking long in your scene?

        if the json is the guilty one, you may want to try to load already deserialized objects to see if that helps? Basically replacing JsonConvert.DeserializeObject() by the result that you can store in a Serialized Object.

        Keep me posted of your progress!

          4 days later

          Hi, thanks for your help, i found the issue that stall webgl loading, i just comment out this 3 lines in loadinternal() and everything looks fine now.

           ThumbnailGeneratorUtils.TakeAndSaveScreenshot(transform, screenshotName, false, new Vector3(1, -1, 1));
                      GameEditorEvents.OnScreenShotSaved?.Invoke(screenshotName, MenuType.FloorMapMenu);
                      GameEditorEvents.OnFileLoaded?.Invoke(GameEditorEvents.FileType.BuildingRead);

          I have another question, when i build the webgl and run in my website, the interior prefab are not loading. I would like to move it into addressable, can you give me a guide where the script i should look for?

          thanks

          Michael

            michaellu88 Hi!
            That's really good to know for the screenshot thanks! I will look into that.

            For the module loading, everything is loaded from the resources folder. If you search for "MODULES_FOLDER" you will find all places where modules are loaded. Can you show me a screenshot + console log ? (or send me a link)

            Thanks

              Write a Reply...