Setting Usable OnUse event method through script
Posted: Thu Feb 25, 2021 7:01 pm
Hey there Toni,
I've been running into a slight issue regarding the Usable scripts OnUse event with prefabs and was wondering if you'd be able to help?
Right now I'm using the OnUse event to call a method with a passed gameobject that allows the player to hold the item.
That gameobject works fine on its own, but whenever I instantiate a prefab of it into a scene it'll load without the reference to the player method and grabbed gameobject since it has no reference of the player in the main scene.
I attempted to find a way to set the OnUse method and gameobject on the prefabs Start() method, but haven't been able to get it to work.
Any ideas?
Thanks!
I've been running into a slight issue regarding the Usable scripts OnUse event with prefabs and was wondering if you'd be able to help?
Right now I'm using the OnUse event to call a method with a passed gameobject that allows the player to hold the item.
That gameobject works fine on its own, but whenever I instantiate a prefab of it into a scene it'll load without the reference to the player method and grabbed gameobject since it has no reference of the player in the main scene.
I attempted to find a way to set the OnUse method and gameobject on the prefabs Start() method, but haven't been able to get it to work.
Any ideas?
Thanks!