using System.Collections; using System.Collections.Generic; using UnityEngine; public class ReadTextureFromList : MonoBehaviour { public bool isVirus; public List TextureList; public int IndexTexture; const float SPERM_SCALE_FACTOR = .5f; static float scaleFactor = SPERM_SCALE_FACTOR; void Start() { if(!isVirus) { TextureList = TextureManager.Instance.ListTexturesSpermsCelebrity; } Init(); } public void Init() { Material m = GetComponent().material; m.mainTexture = TextureList[IndexTexture]; //m.mainTextureScale = new Vector2(TextureList[IndexTexture].width, TextureList[IndexTexture].height); transform.localScale = new Vector3(TextureList[IndexTexture].width * scaleFactor, TextureList[IndexTexture].height * scaleFactor); } }