automatic filling for player

Hello, I have been building my own game for a while. I have a bit of scripting experience but not very much yet. I was wondering if you can have what is written by the arrow automatically filled by unity?

I look forward to your reply

6127298--667910--screenshot.JPG

What does this mean? How would Unity “automatically” know what to fill in there? Do you mean that you want to add a listener via code rather than via the inspector?

I actually meant that the player should be filled in automatically. The player is in the DontDestroyOnLoad. Normally I do that with a tag but I don’t know if you can use that here.

OK, so you need a reference to an object that is in a different scene from this object? That can’t be done with this interface - you’ll need to use some other approach.

I’m only guessing, but it seems like the function (vRemoveItem.RemoveItem) probably could be rewritten so that it doesn’t need to take a parameter at all. It takes a vItemManager parameter, but usually an “item manager” is something that could be implemented as a singleton (a class where there is only ever one instance of that class in the scene, and scripts elsewhere can always easily find that instance - commonly used for UI code and the like).

It may not have been fully explained, my english is not very well. I have 1 player in the whole game but if you go to the next level keep all of his collected items he will take you to the next level. Now I would like to remove 1 item from his inventory. This is only possible if you know who the player is, but I cannot add it to the On Click. Is there a possible way to do that?

hope i have put my question better now

6128021--667976--screenshot 2.JPG