Question by
oliver-jones · Jun 04, 2016 at 12:21 AM ·
c#monobehaviourvoidthis
C# - Pass MonoBehaviour (this) to Void
Hello,
I'm just wondering if theres a quicker way to pass/get a 'this' MonoBehaviour to a void. For example, lets say I have a PlayerManager, and a PlayerController:
//PlayerController.cs
_playerManager.DestoryPlayer(this);
//PlayerManager.cs
void DestoryPlayer(PlayerController _controller){
Destroy(_controller);
}
Instead of having to pass 'this' (PlayerController to PlayerManager), is there a way to automatically detect what MonoBehaviour has called the PlayerManager void to begin with?
Thanks
Comment