Hi,
When attempting to call the GameSession’s ProcessPlayerDeath() method from the Player.cs, I first tried calling it by typing the following statement:
GetComponent().ProcessPlayerDeath();
However, this didn’t have the desired effect (i.e. the scene didn’t restart upon my avatar falling into the spikes).
I then did as instructed in the video and changed the statement to read:
FindObjectOfType().ProcessPlayerDeath();
…and it worked!
Is the reason because the Player.cs can only get components from the player object itself and not components from other objects?
Also, I realise that I thought GetComponent<> and FindObjectOfType<> did very similar jobs and so could work interchangeably, but I think I must be mistaken in this regard…
Any further support you can offer re: the different between these two methods would be gratefully received.
Thanks.