'How to fix DisplayInventory.cs(17,54): error CS0246: The type or namespace name 'GridLayoutGroup' could not be found?
I am trying to create inventory in unity3D, and I present a variable named obj and I try to get his parent component (Grid Layout Group) , But I am getting this error: Assets-Scriptable Objects\Inventory\DisplayInventory.cs(17,54): error CS0246: The type or namespace name 'GridLayoutGroup' could not be found (are you missing a using directive or an assembly reference?) My Code :
public GameObject inventoryPrefab;
private void Start()
{
for (int i = 0; i < inventory.Container.Items.Length; i++)
{
var obj = Instantiate(inventoryPrefab, Vector3.zero, Quaternion.identity, transform);
var objParent = obj.GetComponentInParent<GridLayoutGroup>();
objParent.cellSize = new Vector2(45, 45);
objParent.spacing = new Vector2(6, 6);
itemsDisplayed.Add(obj, inventory.Container.Items[i]);
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
