Итак, я пытаюсь сделать несколько кнопок для «витрины» в моей игре.Я не вижу, где я ошибся в коде, но я получаю эту ошибку:
Assets/shopHandler.cs(34,17): error CS1061: Type
`UnityEngine.GameObject' does not contain a definition for
`transfrom' and no extension method `transfrom' of type
`UnityEngine.GameObject' could be found. Are you missing an assembly
reference?
Мой код:
using System.Collections;
using UnityEngine;
public class shopHandler : MonoBehaviour {
[System.Serializable]
public class Item
{
public string name;
public Sprite icon;
public float price;
public float dps;
public int acquired;
}
public Item[] shopItems;
public GameObject button;
// Use this for initialization
void Start () {
foreach (Item i in shopItems)
{
GameObject btn = (GameObject)Instantiate(button);
ItemScript scp = btn.GetComponent<ItemScript>();
scp.name.text = i.name;
scp.price.text = "Price: $" + i.price.ToString("F1");
scp.acquired.text = i.acquired.ToString();
scp.dps.text = "$/s: " + i.dps.ToString("F1");
scp.icon.sprite = i.icon;
btn.transfrom.SetParent(this.transform);
}
}
// Update is called once per frame
void Update () {
}
}