Addressable(10) loads the resource AB package from the server

Simulate remote publishing of resources

1. Simulate this machine as a resource server and use Unity’s own tools or third-party tools

  • Using addresable hosting

    Please add image description

    Remember to use 192.168.3.83 and 58474 ports

  • Set addressable profile

    Please add image description

2. Set the group as the remote loading path

  • Specify the group to use remote loading

    image-20231121214553225

  • Remember to check Build Remote Catalog

    Please add image description

3. Packing

image-20231121214844063

There are file directories and bundles

4. Test

  • Loaded AB package

    image-20231121215202679

  • code

        void Start()
        {
          
          
            print("开始加载。。。");
            Addressables.LoadAssetsAsync<GameObject>(new List<string>() {
          
           "Cube", "SD" }, (obj) =>
            {
          
          
                var newObj = Instantiate(obj);
                newObj.transform.position = new Vector3(0, 0, 0);
            }, Addressables.MergeMode.Intersection);
        }
    
  • Build the application and test it

    image-20231121215320810

    Successfully loaded the AB package resources of the simulation server

Actual remote publishing of resources

The video uses Windows server + hfs.exe

My server is Linux, so I will skip the steps in the video.

I use Linux server + Pagoda panel to operate

  • server information

    For the website built using typecho, the open port is 80. (This step requires online search)

    image-20231121223340187

  • The process of loading AB package by remote server

    1. Unity packaging

      Please add image description

    2. Upload the packaged files to the server website directory

      image-20231121222953420

      You can use the web page to access the .json file to see if it can be accessed.

      Please add image description

    3. Run the program in Unity to load the AB package from the remote server

      image-20231121223408097

Guess you like

Origin blog.csdn.net/qq_34060370/article/details/134917375