- Home /
Using a prefab button
I'm trying to implement a system such that when an enemy dies, there is a chance for it to give the player a powerup, the player is then able to choose from a popup display with buttons indicating various powerups. These buttons should be able to access the player object's scripts to call methods to give the appropriate powerup.
To do this, I made a prefab powerup display like this:
However, my buttons are unable to access the player GameObject here because it's a prefab
What is another way in which I can program the buttons to my desired effect?
I would preferably like something like the OnPointerClick() method shown here but I don't think this feature is available anymore? https://docs.unity3d.com/2019.1/Documentation/ScriptReference/UI.Button.OnPointerClick.html
Your answer
