Quantcast
Channel: Questions in topic: "log"
Viewing all articles
Browse latest Browse all 235

referencing a gameObject with it's own script

$
0
0
Hello all, I'm having trouble with something very simple: I want to reference a game object with it's own script. public class ItemScript : MonoBehaviour { public Inventory inventory; public ItemType type; public Sprite spriteNeutral; public Sprite spriteHighlight; public int maxSize; private void OnCollisionEnter (Collision other) { if (other.gameObject.tag == "Floor") { inventory.AddItem(this); //here I want it to add this item LogManager.AddLine("Object is picked" + _________.name); //here I want it to get the name of this game object Destroy(gameObject, 3); } } Thanks

Viewing all articles
Browse latest Browse all 235

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>