public void RetargetList(BuildItemContainer buildingContainer) { objPlacer = GetComponent <ObjectPlacer>(); activeKey = objPlacer.ToggleKey; if (BuilderMenuPrefab == null) { Debug.LogError("Missing BuilderMenuPrefab, please assign it!"); return; } if (buildObjectList == null) { Debug.LogError("Missing buildObjectList, please assign it!"); return; } //Transform parent = PlayerInterface.Instance.gameObject.transform; builderUI = Instantiate(BuilderMenuPrefab).GetComponentInChildren <IItemSelectionUI>(); //create the ui if (builderUI == null) { Debug.LogError("Please make sure that the UI prefab has one script that implements: IItemSlectionUI interface"); return; } builderUI.Populatemenu(buildObjectList, this); //populate it if (!buildObjectList.isValid()) { //Debug.LogError("Please add some some Items to list"); return; } }
/**************************************************** * Initialization * *************************************************/ private void Start() { objPlacer = GetComponent <ObjectPlacer>(); activeKey = objPlacer.ToggleKey; if (BuilderMenuPrefab == null) { Debug.LogError("Missing BuilderMenuPrefab, please assign it!"); return; } if (buildObjectList == null) { Debug.LogError("Missing buildObjectList, please assign it!"); return; } builderUI = Instantiate(BuilderMenuPrefab).GetComponentInChildren <IItemSelectionUI>(); //create the ui if (builderUI == null) { Debug.LogError("Please make sure that the UI prefab has one script that implements: IItemSlectionUI interface"); return; } builderUI.Populatemenu(buildObjectList, this); //populate it if (!buildObjectList.isValid()) { Debug.LogError("Please add some some Items to list"); return; } objPlacer.SetObjectToPlace(buildObjectList.items[0]); //use the first item as default and set it }