Unity with the use Addressable Asset Ali cloud resources to achieve remote hosting

Installation in the package manager Addressable
import a model, labeled Addressable resources

open Addressable Profiles window

to create a configuration


changes the remote server address for the address of the server

open Addressable Groups window
Here Insert Picture Description
configuration item to switch to Aliyun just added
Here Insert Picture Description
to establish a group

here renamed Remote group

right of the group, select Inspect group settings

to Build Path and Load Path set RemoteBuildPath and RemoteLoadPath


If you want the resource file after the group packaged separately, you can set up the inspection panel of the group Bundle Mode for the Pack Separately
Here Insert Picture Description
clicks Inspector panel Inspect Top Level Settings, the Build Remote Catalog check, and then the Build Path and Load Path to RemoteBuildPath and RemoteLoadPath
Here Insert Picture Description
back Addressables groups window, just drag the Remote group's model group
Here Insert Picture Description
will switch to third Player Mode Script

begin compiling resources

after compilation, the project file will add a folder that just Build Path settings file folder
Here Insert Picture Description
select mode repackage packaged separately, the resources of the group in a folder (remotegroup_assets_assets) in
Here Insert Picture Description
the upload ServerData \ StandaloneWindows all the files in the server

programming, load a resource in the game is running

public class GameManager : MonoBehaviour
{
    public AssetReference asset;
 
    void Start()
    {
        asset.InstantiateAsync();
    }
}

Select the model you just mark

into the game, Addressable Asset system will automatically check if there is the latest version of the model locally, if there is no local or an old version of the model will download the model, after the download has finished loading into the scene.
Here Insert Picture Description
Just change my resources, uploaded to the server and then re Build to test whether the client can update normal
Here Insert Picture Description
and then back Addressable Groups window, click the Build-Update a Previous Build

then pop up a file selection box, select the project folder \ Library \ com.unity.addressables \ StreamingAssetsCopy \ Windows in addressables_content_state.bin file
Here Insert Picture Description
after recompiling, updates to the server, and then open the game, you can see that resources are properly re-download.
Start a discussion, please have criticized the correction.
This article only spoke of the allocation of resources remotely hosted process, specific instructions on the look Addressable Addressable official documents.

reference:

  1. tomcat: http://tomcat.apache.org/
  2. Addressable 1.3 version of the document https://docs.unity3d.com/Packages/[email protected]/manual/index.html
Published 23 original articles · won praise 63 · views 80000 +

Guess you like

Origin blog.csdn.net/qq_15505341/article/details/103049919