// Use this for initialization void Start() { Hero MyHero = new Hero(); MyHero.setHP(30); MyHero.setMaxHP(30); MyHero.setAtk(0); MyHero.setType(HERO_TYPE.CSE); Material mat; if (MyHero.getType() == HERO_TYPE.CSE) { mat = (Material)Resources.Load("../Material/" + MyHero.getType() + "HeroMaterial.prefab"); gameObject.GetComponent<Renderer>().material = mat; } else if (MyHero.getType() == HERO_TYPE.CITE) { mat = (Material)Resources.Load("../Material/" + MyHero.getType() + "HeroMaterial.prefab"); gameObject.GetComponent<Renderer>().material = mat; } else if (MyHero.getType() == HERO_TYPE.EE) { mat = (Material)Resources.Load("../Material/" + MyHero.getType() + "HeroMaterial.prefab"); gameObject.GetComponent<Renderer>().material = mat; } else { mat = (Material)Resources.Load("../Material/" + MyHero.getType() + "HeroMaterial.prefab"); gameObject.GetComponent<Renderer>().material = mat; } }