how to get a text file/ video from azure blob storage to unity3d game Object (TextMP)

Hello everyone, I am making a Project which I want to load different Text file and a Video from Azure Blob Storage to unity. Actually I am a beginner and have no Idea how to Start. I wish I could find a help here.

So I made a Text Mesh Pro object, where I want to load my text, I saw in unity Documentation Unity Web Request Get a script but I didn’t understand well how should I use it or if it can help me…

I hope i can get an answer from You. Thank you

I’ve done this recently, start with this: https://github.com/Unity3dAzure/StorageServices then use this as the example: https://github.com/Unity3dAzure/StorageServicesDemo (you only need to add the first to your project)

The important part is your saving/loading script needs a StorageServiceClient and a BlobService object. You need to initialise then like so:

_client = StorageServiceClient.Create(storageAccountName, accessKey);
_blobService = _client.GetBlobService();

With the storageAccountName and accessKey being obtained from the storage account you made on the portal.

Then when you want to save text to your blob you can call _blobService.PutTextBlob like so:

_blobService.PutTextBlob(response =>
{
    // this code will get ran when you get azure's response to your request
    Debug.Log($"Was a success ? {!response.IsError}");
}, _yourTextMeshProComponent.text, nameOfYourBlob, nameOfTheFileOnYourBlob);

This might look like a weird function call, the first argument is just the callback - the code that gets executed once the service returns a response. You can just as easily write:

_blobService.PutTextBlob(OnPutTextResponse, _yourTextMeshProComponent.text, nameOfYourBlob, nameOfTheFileOnYourBlob);

// ... after making the function OnPutTextResponse as so:

private void OnPutTextResponse(RestResponse response)
{
    // this code will get ran when you get azure's response to your request
    Debug.Log($"Was a success ? {!response.IsError}");
}

And you can load text to your blob with the similar GetTextBlob function:

_blobService.GetTextBlob(response =>
{
    if (response.IsError)
    {
        Debug.LogError($"Could not load text : {response.ErrorMessage}");
        return;
    }
    
    Debug.Log($"Successfully loaded text : {response.Content}");
    _yourTextMeshProComponent.text = response.Content;
}, nameOfYourBlob);

I hope this clarifies things a little, let me know if you have need any more help!