Like this?
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class VectorIdentificator : MonoBehaviour
{
//fill this in the editor
public List list;
private void Start()
{
Debug.Log("All content:");
ShowFullContent();
Debug.Log("__");
Debug.Log("Only with ID = 1");
ShowByID(1);
}
public void ShowFullContent ()
{
foreach(VectorID current in list)
{
Debug.Log(current.id);
Debug.Log(current.vector);
}
}
public void ShowByID (int i)
{
VectorID temp = FindByID(i);
if(temp != null)
{
Debug.Log(temp.id);
Debug.Log(temp.vector);
}else{
Debug.Log("There is no Vector with id = "+i);
}
}
public VectorID FindByID(int id)
{
foreach(VectorID current in list)
{
if(current.id == id)
{
return current;
}
}
return null;
}
}
[System.Serializable]
public class VectorID
{
public int id;
public Vector3 vector;
}
↧