Im following BurgZerg Arcades inventory videos so bear in mind i only just cut in…
I kinda understand what this does, im guessing when a line of code says “ToggleInventory” from a different script, the listener from another will keep a ear out for this and once the message is heard it will execute another bit of code. Am i correct?
So i typed it and Unity dosnt like ‘Messenger.AddListener’. Why?
private void OnEnable(){
Messenger.AddListener ("ToggleInventory", ToggleInventoryWindow);
}
This is so that the player can turn the inventory on/off
Heres the other end of the code.
if (Input.GetKey ("Inventory"))
{
SendMessage("ToggleInventory");
}
send message is unity function and has nothing to do with the messenger (which you have not posted code/source for). usually the messenger has a function to invoke a certain message and internally calls the subsrcibed listener delegates. so you have to use this function instead of sendmessage in order the listeners to be executed.
No offence, I really didn’t understand any of that…
Could you point me in the direction of any tutorials or videos for this.
I have no idea what this is.
Im following tutorial series i just cut into for a certain section I need
Are you using the C# messenger from the wiki?
If so, you should call Messenger.Broadcast() instead of SendMessage
when you don’t understand what a system does why use it? when a tutorial is way above your understanding why don’t do a simpler one? when having problems with burgzergarcade’s tutorials why not ask him?
i thought you already follow a tutorial. maybe you should repeat it from the beginning until you understand everything before moving on to “advanced” topics.
so when you omit the previous tutorials which may explain what you need i shall point to you some? sounds weird to me. simply do them from the beginning one after another until you get what it does and why it’s done. when you can’t learn from the tutorial you have already i doubt you can learn from one you are pointed at by someone.
and you definitely “need” to know the basics so do them until you have a proper understanding before doing stuff you think you need.