using UnityEngine;
using System.Collections;
public class RagdollController : MonoBehaviour {
public GUISkin guiSKin;
public GameObject cam;
//Make rigidbody kinematic after, also it is used as Wait For respawn time
public int timer;
//Display timer gui or not
bool gui;
// Use this for initialization
void Start () {
StartCoroutine(sleepRigidbody());
}
}
void OnGUI(){
if(gui && cam){
GUI.skin = guiSKin;
GUI.Label(new Rect(Screen.width/2-75, Screen.height/2-15, 150, 30), "Killed! respawning in " + timer);
if(GUI.Button(new Rect(Screen.width / 2 - 100, Screen.height / 2 - 100, 200, 50)
{
GameObject.FindWithTag("Network").SendMessage("SpawnPlayer", (string)PhotonNetwork.player.customProperties["TeamName"]);
Destroy (this);
clearCamera();
}
}
void clearCamera(){
Destroy(cam);
}
IEnumerator sleepRigidbody(){
//Make ragdoll kinematic
yield return new WaitForSeconds(timer);
foreach(Rigidbody c in transform.root.GetComponentsInChildren<Rigidbody>()){
c.isKinematic = true;
}
}
}
This is my code, I get a red underline at the void OnGUI line and I have no idea why. Tried changing those brackets, but then the underlines show up somewhere else. can anyone help me ASAP plz?
thanks in advance