Попробовал твою систему, сделал как все ты говорил, создал плейн, текстуру на него и скрипт, сохранил его префаб и удалил со сцены, в свой скрипт Health вставляю:
using UnityEngine;
using System.Collections;
public class Health : MonoBehaviour {
public int health = 80;
private int maxHealth = 80;
void OnGUI()
{
GUI.Box(new Rect(10,Screen.height-55,150,20),"");
GUI.Label(new Rect(25,Screen.height-55,150,20),"Health: " + maxHealth + " / " + health);
if(health >= maxHealth) health = maxHealth;
if(health <= 0)
{
health = 0;
transitPlane=(GameObject)Instantiate(TransitPlane);
transitPlane.GetComponent<LevelChange>().LevelNumber = "Scene2";
}
Пишет ошибки:
The name `TransitPlane' does not exist in the current context
The best overloaded method match for `UnityEngine.Object.Instantiate(UnityEngine.Object )' has some invalid arguments
The best overloaded method match for `UnityEngine.Object.Instantiate(UnityEngine.Object )' has some invalid arguments
The name `transitPlane' does not exist in the current context
The name `transitPlane' does not exist in the current context
|