목록의 개체에서 해당 태그를 확인하려고합니다. 그리고 "clean"과 일치하는 각 태그에 대해 정수를 올려야합니다. 이것이 가능한가? 그렇다면 어떻게해야합니까?목록의 태그 C#
미리 감사드립니다.
P .: 이것은 내가 지금 가지고있는 것입니다. 당신은 Linq에로 시도 할 수
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>();
}
}
완전히 가능하고 또한 매우 쉽습니다. 온라인 검색을 제안하고 특정 질문을하고 나서 무엇을 생각해 낼 수 있는지 알아볼 것입니다. 그렇게하면 훨씬 더 배우게 될 것입니다. – CSharpened
나는 이미 그렇게 해보았지만 간단한 대답을 찾는 것이 쉽지는 않다. 적어도 나를 위해 : S. – Amacoder