public void AddCrush() { GameObject go = content.AddChild(stepPrefab); RecipeStep step = go.GetComponent <RecipeStep>(); step.icon.sprite = Resources.Load <Sprite>("Icons/crush"); TooltipSpawner spawner = go.GetComponent <TooltipSpawner>(); spawner.SetContent("Crush"); }
public void AddIngredient(Ingredient ingredient) { GameObject go = content.AddChild(stepPrefab); // Set icon if (!string.IsNullOrEmpty(ingredient.icon)) { string resourcePath = Path.Combine("Icons", ingredient.icon); Sprite s = Resources.Load <Sprite>(resourcePath); if (s != null) { RecipeStep step = go.GetComponent <RecipeStep>(); step.icon.sprite = s; } } // Setup tooltip spawner TooltipSpawner spawner = go.GetComponent <TooltipSpawner>(); spawner.SetContent(ingredient.name); }