Unity Web Tool by GimChuang - 5

Tools

Simple scripts to upload pictures to your server and generate QR codes from the pictures' URL.

Unity 2018.2.8f1Unknown LicenseUpdated 1 year agoCreated on March 13th, 2019
Go to source

UnityWebTool

Simple scripts featuring uploading picture to your server and generate QR codes from the pictures’ url. There is a Test_WebTool sample scene showing how I use the scripts.

Dependency

This project use LitJson to parse Json files and ZXing to generate QR codes.

Scripting Reference

WebTool.cs

UploadPhoto(Texture2D _textureToUpload, string _fileName)

uploads _textureToUpload as a png with _fileName as its filename. Internally this function uses UnityWebRequest to upload the picture to urlForUploading with bodyKey and mimeType. If the uploading is successful, it parses downloaded json string to get the picture’s url for QRCodeGenerator.cs to generate a QR code. Note that it’s for my use case and it may not fit your need 😉

OnUploadPhotoReqFinish(bool success, string photoUrl)

is called when the WebRequest finishes.

QRCodeGenerator.cs

GenerateQRCode(string _textToEncode)

encodes _textToEncode to a Texture2D.

OnQRCodeGenerated(Texture2D _texture)

is called when the QR code is generated.

Note

This project use Git submodule gm_WebcamTool. You need to call

git clone --recurse-submodules <URL>

when you clone this reposiory.

Show all projects by GimChuang