Back To Index
PlayerRespawn
Jump To Parameters
Jump To Function Definitions
Parameter Definitions
Select the parameter name from below to jump directly to it on this page.
broadcastDeathMessage
deathMessage
debugging
respawnDelay
respawnPoint
respawnType
tag
teamName
teams
visualCountdown
broadcastDeathMessage
Whether or not you want to send a message via the ChatBox (as a BroadCast Message event) “
when this player dies. Remember that you need to do something with it by opening the UnityEvent “
found on the chatbox under the events tab.
| Exposed Value |
Type |
Default Value |
| protected |
bool |
false |
Back To Top
deathMessage
The message that will be broadcast via the chatbox as a BroadCast Message event. “
Remember that you need to do something with it by opening the UnityEvent found on the chatbox “
under the events tab.\n\n”
"{Nickname}" will be replaced with the photon player’s name.\n\n”
"{Damager}" will be replaced with the source player name (if a player, otherwise the transform name) that dealt the killing blow.\n\n”
"{DamageType}" will be replaced with the damage type that was last recorded.
| Exposed Value |
Type |
Default Value |
| protected |
string |
“{Nickname} has been killed by {Damager} by using {DamageType}.” |
Back To Top
debugging
If you want a verbose log of what is happening in this script to help you debug things.
| Exposed Value |
Type |
Default Value |
| protected |
bool |
false |
Back To Top
respawnDelay
How long to wait before your player will respawn
| Exposed Value |
Type |
Default Value |
| protected |
float |
5.0f |
Back To Top
respawnPoint
Mostly here for debugging purposes. The point where the player will respawn. Is auto selected based on the RespawnType.
| Exposed Value |
Type |
Default Value |
| public |
Transform |
null |
Back To Top
respawnType
What type of respawning system are you using?\n\n”
ClosestPoint = Will find the closest respawn point to where you died and use that.\n\n”
//”TeamBased = Find the highest concentration of people on your team and spawn at the respawn point closest to them.\n\n”
LastSavePoint = Respawn at whatever is currently set in the respawnPoint transform field.\n\n”
Random = Randomly choose a respawn point and respawn there.\n”
TeamStatic = Find a random spawn point according to your teams tag and spawn there.\n”
TeamDynamic = Find the spawn point that most of your team is next to and spawn there.
| Exposed Value |
Type |
Default Value |
| protected |
RespawnType |
RespawnType.ClosestPoint |
Back To Top
tag
Only matters if you have selected "TeamStatic" as your respawn type. “
The tag that will be found in your scene to determine where you should spawn.
| Exposed Value |
Type |
Default Value |
| public |
string |
“SpawnPoint” |
Back To Top
teamName
The name of your team.
| Exposed Value |
Type |
Default Value |
| public |
string |
“New Team” |
Back To Top
teams
The team names and the tags that will be used as respawn points for that team.
| Exposed Value |
Type |
Default Value |
| protected |
SpawnTeam[] |
new SpawnTeam[] { } |
Back To Top
visualCountdown
The prefab to display when doing a countdown. Does not have to come from the "Resources" folder.\n\n”
This object needs to implement a function called "StartCounting". The component "Counter" has “
this built in if you would like to make use of it.
| Exposed Value |
Type |
Default Value |
| public |
GameObject |
null |
Back To Top
Function Definitions
Select the function name from below to jump directly to it on this page.
Respawn
Respawn
RespawnAction
SelectDynamicTeamSpawn
SelectRespawnPoint
SelectStaticTeamSpawn
SetRespawnState
public virtual void Respawn(bool keepItems, GameObject lastDamager=null, string lastDamageType=null)
Calls the base Respawn function. This is used to get the photon view component from the owning player before calling Respawn.
| Expose Value |
Overrideable |
Returns |
| public |
True |
Does not return anything |
| Parameter Name |
Description |
| keepItems |
bool type, keep the items of the player that is respawning |
| lastDamager |
Gameobject type, the gameobject of the thing that dealt the last bit of damage |
| lastDamageType |
string type, the type of damage that was received. |
Back To Top
public virtual void Respawn(PhotonView playerView, bool keepItems, GameObject lastDamager = null, string lastDamageType = “”)
Calls the RespawnAction IEnumerator to start the respawning process.
| Expose Value |
Overrideable |
Returns |
| public |
True |
Does not return anything |
| Parameter Name |
Description |
| playerView |
PhotonView type, the photonview of the player respawning |
| keepItems |
bool type, keep the items of the player that is respawning |
| lastDamager |
Gameobject type, the gameobject of the thing that dealt the last bit of damage |
| lastDamageType |
string type, the type of damage that was received. |
Back To Top
protected virtual IEnumerator RespawnAction(PhotonView playerView, bool keepItems, GameObject lastDamager = null, string lastDamageType = “”)
Will set the death message based on the inputs and broadcasts that message via the Chatbox’s data channel to everyone in the session, but only if you allow this. Enables the respawn visual component and starts the countdown. After waiting for the respawnDelay time it calls NetworkInstantiatePrefab from the NetworkManager to instantiate your new player and sets all of its needed values at a target respawn point. It will then destroy the old player based on the photonView.
| Expose Value |
Overrideable |
Returns |
| protected |
True |
Does not return anything |
| Parameter Name |
Description |
| playerView |
PhotonView type, the photonview of the player respawning |
| keepItems |
bool type, keep the items of the player that is respawning |
| lastDamager |
Gameobject type, the gameobject of the thing that dealt the last bit of damage |
| lastDamageType |
string type, the type of damage that was received. |
Back To Top
Returns a random point that one of your team mates is at.
| Expose Value |
Overrideable |
Returns |
| public |
True |
Transform point of a found team member |
| Parameter Name |
Description |
| teamName |
string type, the name of the team to try and find a point for |
Back To Top
Will return a target respawn point based on the settings in this component.
| Expose Value |
Overrideable |
Returns |
| protected |
True |
Transform of the target respawn point. |
| Parameter Name |
Description |
| targetView |
The player’s PhotonView that needs to select a respwn point |
Back To Top
Selects and random “Team” spawn point. These spawn point names are defined in the NetworkManager component.
| Expose Value |
Overrideable |
Returns |
| public |
True |
Transform of the target respawn point |
| Parameter Name |
Description |
| teamName |
string type, the team spawn point name to randomly pick |
Back To Top
public void SetRespawnState(bool isEnabled)
Enable or disable this isRespawning variable.
| Expose Value |
Overrideable |
Returns |
| public |
False |
Does not return anything |
| Parameter Name |
Description |
| isEnabled |
bool type, is respawning? |
Back To Top