
Untitled
By: a guest on
Apr 29th, 2012 | syntax:
None | size: 0.78 KB | hits: 14 | expires: Never
Tags in list c#
using UnityEngine;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class productManager : MonoBehaviour {
public string ownerName = "";
public List<Transform> ingredients = new List<Transform>();
//public int count = (from Object in List<Transform> ingredients where Object.Tags.Contains("clean") select Object).Count<Transform>();
void Start(){
ownerName = transform.name;
name = ownerName + "'s ingredients";
}
void Update(){
int count = (from Object in List<Transform> where Object.Tags.Contains("clean") select Object).Count<Transform>();
}
}
var itemsWithCleanTag = myList.Where(item => item.Tag == "clean");
foreach(var item in itemsWithCleanTag)
{
item.Raise(5);
}