Oxlamon
New member
Hi. I want to use procedural weapons like borderlands. i knew that is not possible because of ItemType must be created in editor time. But..
1) I created a weapon A and weapon B (all have same ItemType: OneHandWeapon), but different models (and pickup prefabs), scripts and etc.
2) Then i picked up one of them, gameObject splitted by 2 objects (one to ItemsPlacement and second to visual parent: ItemSlot )
3) If i dropped this item it remains in ItemsPlacement and in arms (but visual part is just hidden)
4) And if i picked up other gun, system just using cached versions.
i know this is by design, but how to remove an item (from inventory and arms) when i dropped it.
first of all i rewrite ItemPickup.cs to remove pooling
second: added script to each item, and use OnDrop event (quick and dirty way, just PoC)
but then i picked up again item, nothing happens
what's next. i need to clear ItemsPlacement and ItemSlot for this item. show me the right way)
p.s. Excuse me, my english is very bad...
1) I created a weapon A and weapon B (all have same ItemType: OneHandWeapon), but different models (and pickup prefabs), scripts and etc.
2) Then i picked up one of them, gameObject splitted by 2 objects (one to ItemsPlacement and second to visual parent: ItemSlot )
3) If i dropped this item it remains in ItemsPlacement and in arms (but visual part is just hidden)
4) And if i picked up other gun, system just using cached versions.
i know this is by design, but how to remove an item (from inventory and arms) when i dropped it.
first of all i rewrite ItemPickup.cs to remove pooling
var itemGameObject = Instantiate(m_ItemPickupSet[i].Item, Vector3.zero, Quaternion.identity, itemPlacement.transform);
second: added script to each item, and use OnDrop event (quick and dirty way, just PoC)
C#:
public class CleanupOnDrop: MonoBehaviour {
public void Cleanup( Item item ) {
var visual = item.GetComponent<FirstPersonPerspectiveItem>().VisibleItem;
Destroy( visual );
Destroy( item.gameObject );
}
}
what's next. i need to clear ItemsPlacement and ItemSlot for this item. show me the right way)
p.s. Excuse me, my english is very bad...