How can I Initialize an array in class?

Advertisements public class DataClass { public int[] collectionData; } [SerializeField] private DataClass[] DataClassArray; I have created above field in which class consists of an array, and the object of that class is also an array. public void GenerateCategariesData() { Debug.Log("==========>******" + bookCatogaryObject.Data.Rows.Count); collectionCounts = new int[bookCatogaryObject.Data.Rows.Count]; DataClassArray = new DataClass[bookCatogaryObject.Data.Rows.Count]; for (int i = 0;… Read More How can I Initialize an array in class?

If I assign an Object as GameObject, I cant get the RectTransform to work. How to fix that?

Advertisements I want to give my Parent GameObject Inventory spicific rec-coordinates via this line of code: Inventory.GetComponent<RectTransform>().position = new Vector3(500f, 0f, 0f); In the editor, the object Inventory is assigned as a GameObject, so it keeps changing the rec-coordinates to world-coordinates. I’ve tried assigning the Inventory as a Transform and RectTransform but it says that… Read More If I assign an Object as GameObject, I cant get the RectTransform to work. How to fix that?

How can i get an ui element to point towards a position that is in world coordinates in unity?

Advertisements So im trying to make an arrow point towards a position in my scene, i want to rotate the arrow to that position. I have tried to make the world position into a screen position and then subtracting the position of the arrow from that and then settig the rotation, but im having some… Read More How can i get an ui element to point towards a position that is in world coordinates in unity?