continuing fixes for dropping items
This commit is contained in:
parent
3e0ac77ed4
commit
05fcd17618
@ -41,15 +41,22 @@ namespace SimpleInventorySystem
|
||||
{
|
||||
GameObject gObj = Instantiate(prefabs[i]);
|
||||
ItemUI item = gObj.GetComponentInChildren<ItemUI>();
|
||||
PickUp pickUp = gObj.GetComponentInChildren<PickUp>();
|
||||
gObj.SetActive(true);
|
||||
gObj.transform.position = Vector3.zero;
|
||||
gObj.transform.SetParent(this.transform, false);
|
||||
gObj.GetComponent<Rigidbody>().useGravity = false;
|
||||
if(item != null)
|
||||
{
|
||||
item.gameObject.SetActive(true);
|
||||
pickUp.gameObject.SetActive(true);
|
||||
AddOwnership(item, this);
|
||||
//item.transform.SetParent(transform, true);
|
||||
item.InitializeImageSize();
|
||||
item.ResetTransform();
|
||||
//gObj.transform.SetParent(item.transform, true);
|
||||
gObj.SetActive(false);
|
||||
//gObj.SetActive(false);
|
||||
//item.pickUp = gObj.GetComponentInChildren<PickUp>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ namespace SimpleInventorySystem
|
||||
else
|
||||
{
|
||||
itemUI.pickUp = this;
|
||||
Debug.Log("itemUI assigned:" + ItemGameObject.name);
|
||||
}
|
||||
|
||||
pickUpRange = GetComponentInChildren<PickUpRange>();
|
||||
|
@ -37,7 +37,10 @@ namespace SimpleInventorySystem
|
||||
|
||||
public void DetachItemGameObject(GameObject go, ItemUI itemUI)
|
||||
{
|
||||
itemUI.targetAttachment.DetachItemGameObject(go);
|
||||
if(itemUI.targetAttachment != null)
|
||||
{
|
||||
itemUI.targetAttachment.DetachItemGameObject(go);
|
||||
}
|
||||
itemUI.pickUp.DropDownHandler();
|
||||
itemUI.targetAttachment = null;
|
||||
itemUI.gameObject.transform.SetParent(go.transform);
|
||||
|
@ -1012,7 +1012,7 @@ Camera:
|
||||
m_Depth: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 3355181055
|
||||
m_Bits: 268173111
|
||||
m_RenderingPath: -1
|
||||
m_TargetTexture: {fileID: 0}
|
||||
m_TargetDisplay: 0
|
||||
|
Loading…
Reference in New Issue
Block a user