Hi all,
When an enemy dies, he loots objects, in this case, a heart (being Instantiated)
I would like to change the string “itemType” in the script “Item.cs” attached to this heart object
but I have no clue how to make this work
so an abreviation of the question is: how to change a variable of an Instantiated object (in C#)?
here is my actual instantiation code:
Rigidbody InstantiatedHeart = Instantiate(heart, gameObject.transform.position, gameObject.transform.rotation) as Rigidbody;
Item item = gameObject.GetComponent<Item>;
item.itemType = "Heart";
But I get an error on the second line:
"
error CS0428: Cannot convert method group GetComponent' to non-delegate type
Item’. Consider using parentheses to invoke the method
"
but I dont understant what I must modify…
Thank you all for any help possible