I am a beginner using Unity, I managed to write simple unit tests using the Unity test tools, but now I need to test a bit more complex(not really) classes. Each of these classes has a Game Object which I want to test for certain behavior. How can I achieve this using the Unity test tools? I have tried various different ways, but nothing works. To help a bit illustrate my problem, heres an example class that i would like to test:
using UnityEngine;
using System.Collections;
public class Disappear : MonoBehaviour, DisappearInterface
{
public void Vanish (Collision2D col)
{
if(col.gameObject.tag == "Player")
{
Remove();
}
}
public void Remove ()
{
GameObject.Destroy(this.gameObject, 0.5f);
}
void OnCollisionEnter2D (Collision2D col)
{
Vanish(col);
}
}
Aucun commentaire:
Enregistrer un commentaire