Version: 2019.3
public byte[] bytes ;

説明

テキストアセットの byte 配列(読み取り専用)

バイナリデータを含む TextAsset を使用する場合は、ファイルの拡張子は .bytes にしてください。 それ以外の拡張子であった場合、utf8 文字列のファイルとして解析できないと、TextImporter は ASCII でない文字としてストリップするよう試みます。

using UnityEngine;

public class Example : MonoBehaviour { // Load a .jpg or .png file by adding .bytes extensions to the file // and dragging it on the imageTA variable.

TextAsset imageTA;

void Start() { var tex = new Texture2D(4, 4); tex.LoadImage(imageTA.bytes); GetComponent<Renderer>().material.mainTexture = tex; } }