Example #1
0
 public void SetModel(GameObject model, string toneColor, string eyeColor = "black")
 {
     try
     {
         SpriteRenderer shapeTex  = model.GetComponent <SpriteRenderer>();
         string         modelName = shapeTex.sprite.texture.name.Split('_')[0];
         string         fileName  = "images/models/female/" + modelName + "/" + toneColor + "/" + modelName + "_" + toneColor + "_" + eyeColor;
         print(fileName);
         Texture2D tmptex = Resources.Load(fileName) as Texture2D;
         shapeTex.sprite = Sprite.Create(tmptex, new Rect(0, 0, tmptex.width, tmptex.height), new Vector2(0.5f, 0.5f), 100f);
         rotationController.CheckForBodyToneChange();
     }
     catch (System.Exception e)
     {
         print("error setting model : " + e);
     }
 }