Hi, i was trying to access to a methodle that is in the parent of an object so i tried to: "itemInTheSlot.transform.parent.GetComponent<InventorySlot>().WhoIsChildUpdate;" were itemInTheSlot is the child. I was trying to access to the method "WhoIsChildUpdate" of the script "InventorySlot" that is attached to the parent of "itemInTheSlot". Do you know why it is an error?
#Problem with a GetComponent
10 messages · Page 1 of 1 (latest)
the error says: Only assign, call, increment, decrement, wait, and new object expressions can be used as statements
You're missing the parentheses after the method name.
Oh yeah it worked now
🤦♂️
i treated it like a variable
If you want to call a method, you always need to end with (), otherwise you're accessing the method declaration instead.
Sometimes this is what you want, but normally not.
Dammit, you are intelligent 🧠
Lend me your brain when it's idle 😁
yes thanks, i forgot it was a method and not a variable 