using System.Collections.Generic; using UnityEngine; public class BuildUI : WPFMonoBehaviour { public GameObject m_partButtonPrefab; public GameData m_gameData; private ScrollList m_scrollList; private void Start() { m_scrollList = base.transform.FindChild("ScrollList").GetComponent(); List parts = m_gameData.m_parts; foreach (GameObject item in parts) { GameObject gameObject = (GameObject)Object.Instantiate(m_partButtonPrefab); gameObject.transform.parent = m_scrollList.transform; GameObject gameObject2 = item.GetComponent().m_constructionIconSprite.gameObject; gameObject.GetComponent().DragIconPrefab = gameObject2; gameObject.GetComponent().DragIconScale = 1.75f; gameObject.transform.FindChild("PartCount").GetComponent().text = Random.Range(1, 20).ToString(); GameObject gameObject3 = (GameObject)Object.Instantiate(gameObject2); gameObject3.transform.parent = gameObject.transform; gameObject3.transform.localScale = new Vector3(1.75f, 1.75f, 1f); gameObject3.transform.localPosition = new Vector3(0f, 0f, -0.1f); m_scrollList.AddButton(gameObject.GetComponent()); } } }