public T component ;

描述

附加到此对象的测试组件。

using UnityEngine;
using UnityEngine.TestTools;
using NUnit.Framework;
using System.Collections;

public class NewPlayModeTest { [UnityTest] public IEnumerator NewPlayModeTestWithEnumeratorPasses() { var test = new MonoBehaviourTest<MonoBehaviourTestable>(); yield return test;

MonoBehaviour.Destroy(test.gameObject); }

public class MonoBehaviourTestable : MonoBehaviour, IMonoBehaviourTest { public bool IsTestFinished { get; private set; }

public void Start() { IsTestFinished = true; }

public void SayHello() { Debug.Log("Hello world!"); } } }