Alright, so here I am trying to make a Networked Kill Feed, so when someone frags the other player, it registers up in the frag list. This is the base script for that killfeed:
public List
<string> fragFeed
= new List
<string>();
void OnGUI()
{
// The frag feed.
GUILayout
.BeginArea(new Rect
(Screen
.width - 320, Screen
.height - (amtOfFragsShown
* 24),
310,
(amtOfFragsShown
* 24))); GUILayout.BeginVertical();
for (int i = 0; i > amtOfFragsShown; i++)
{
GUILayout.Box(fragFeed[i]);
}
GUILayout.EndVertical();
GUILayout.EndArea();
}
[RFC]
void AnnouncePlayerAction(string whatHappened)
{
Debug.Log("Got a player announcement...");
fragFeed.Add(whatHappened);
}
In the appropriate scripts, I have this. This is taken from the player vitals script, which is basically the "heart" of the player - if they die, it does all the required things on death (respawn, ragdoll, etc). This function is the one that gets triggered when you take the easy way out or you fall into the void and the level OOB triggers hit the character.
// ......
private void KillSelf()
{
AnnouncePlayerAction(TNManager.playerName + " ended it all");
currHealth = 0;
}
[RFC]
void AnnouncePlayerAction(string whatHappened)
{
Debug.Log("Got a player announcement...");
to.Send("AnnouncePlayerAction", Target.All, whatHappened);
// fragFeed.Add(whatHappened);
}
However, the issue here is that it loops itself and basically freezes Unity or the Unity Player, requiring a Task Manager to kill the process. Basically, I want to have one script fire the RFC to "announce" the event, and then the other script, which is the Network Feed script, to pick up the message, add it to the list, and then go from there.
Could you assist?