Author Topic: Asset Bundled NGUI  (Read 16282 times)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Asset Bundled NGUI
« Reply #15 on: February 12, 2016, 08:42:09 PM »
No, don't try to change the material of sprites. Change the material of your atlas instead. Also, why bother with asset bundles at all?
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ReplaceAtlasMaterial : MonoBehaviour
  5. {
  6.         public UIAtlas atlas;
  7.         public string url = "http://www.yourwebsite.com/atlas.png";
  8.  
  9.         IEnumerator Start ()
  10.         {
  11.                 WWW www = new WWW(url);
  12.                 yield return www;
  13.                 atlas.spriteMaterial.mainTexture = www.texture;
  14.                 www.Dispose();
  15.         }
  16. }