[UNITY] ใช้ AssetBundle ด้วย Resources.Load (ไม่ต้องใช้ Internet) by

30
Apr
0

หากอยากใช้ AssetBundle ที่เราเตรียมไว้แล้ว แต่ไม่อยากให้โหลดจาก server ของเรา ก็มีวิธีการดังนี้

  1. ให้เปลี่ยนนามสกุลของไฟล์ AssetBundle ให้เป็นไฟล์ .txt
  2. จากนั้นนำไฟล์ AssetBubdle.txt ไปใส่ไว้ใส Folder Resources ของ Unity Project
  3. ใช้ code ชุดนี้ ในการโหลด AssetBundle

    fileAsText = Resources.Load("AssetBundle.txt") as TextAsset;
    byte[] bundleData = fileAsText.bytes.Clone() as byte[];
    AssetBundleCreateRequest bundleRequest = AssetBundle.CreateFromMemory( bundleData );
  4. เราก็จะได้ bundleRequest.assetBundle เป็น AssetBundle มาให้ใช้ได้ตามอัธยาศัย

Enjoy this article?

Consider subscribing to our RSS feed!

ไม่มีความเห็น

ยังไม่มีความเห็น

ใส่ความเห็น

RSS feed for comments on this post

 เราชนะรอบ 4 | ยืมเงิน 3000 ด่วน | แอพกู้เงิน | แอพเงินด่วน | สินเชื่อออนไลน์อนุมัติทันที | Site Map | กู้เงินก้อน | กระเป๋าตัง | thisshop และ ยืมเงินฉุกเฉิน 5000 ด่วน