Юнити выдаёт в консоль: "the name instantiate does not exist in the current context".
Не понимаю почему, вот код на который он ругается:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Mixer : MonoBehaviour
{
public GameObject[] drinks; // исп. так: ...drinks[1]; (вызываем 2 в списке)
public GameObject taste;
public GameObject texture;
public GameObject color;
public GameObject newDrink;
public GameObject drinkPosition; // где напиток будет спавнится
private int texture_;
private int taste_;
private int color_;
private int drinkInt;
public void Mix() // когда нажимаем кнопку "приготовить"
{
// check taste rn
// check texture rn
// check color rn
//типа:
texture_ = texture.gameObject.GetComponent<TextureBox>().mixTexture;
taste_ = taste.gameObject.GetComponent<TasteBox>().mixTaste;
color_ = color.gameObject.GetComponent<ColorBox>().mixColor;
if(taste_ == 1 && texture_ == 1 && color_ == 1) // #1
{
Debug.Log("Drink #1 is ready!!! :D");
drinkInt = 1;
SpawnDrinks();
newDrink.SetActive(true);
}
if (taste_ == 2 && texture_ == 2 && color_ == 2) // #2
{
Debug.Log("Drink #2 is ready!!! :D");
drinkInt = 2;
SpawnDrinks();
newDrink.SetActive(true);
}
else
{
Debug.Log("Not mixing...");
}
texture_ = 0; taste_ = 0; color_ = 0; drinkInt = 0;
}
public void SpawnDrinks()
{
GameObject drinksSp = instantiate(drinks[drinkInt]);
drinksSp.transform.position = drinkPosition.transform.position;
}
}