private void Start() { myInventory = FindObjectOfType <Inventory>(); myEditorSpawnObject = FindObjectOfType <Editor_SpawnObject>(); btn = GetComponent <Button>(); myImage = GetComponent <Image>(); myImage.sprite = Resources.Load <Sprite>("Items_Images/" + objType + "/" + objName); myObj = (GameObject)Resources.Load("Items/" + objType + "/" + objName); if (myObj == null) { throw new System.Exception("Failed to load Item resource!"); } if (myImage == null) { throw new System.Exception("Failed to load Item Image resource!"); } btn.onClick.AddListener(delegate() { myEditorSpawnObject.PreviewObject(myObj, objName); }); }
void Start() { input = GetComponent <InputBehaviour> (); editorObjectSpawner = GetComponent <Editor_SpawnObject> (); }