本文整理汇总了C#中Tags.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Tags.ToString方法的具体用法?C# Tags.ToString怎么用?C# Tags.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tags
的用法示例。
在下文中一共展示了Tags.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddTag
/// <summary>
/// Add a tag to this gameobject if it does not already exist. Also add the tagger component to the gameobject if it doesn't exist
/// </summary>
/// <param name="go">The game object</param>
/// <returns>A list of tags</returns>
public static void AddTag(this GameObject go, Tags tag)
{
var tagger = go.GetComponent<TagFrenzyList>();
if (tagger == null)
{
tagger = go.AddComponent<TagFrenzyList>();
}
//Make sure no deleted tags are hanging around before we add new ones
tagger.CleanupDeletedTags();
if (!tagger.SelectedEditorTags.Where(t => t.Tag == tag.ToString()).Any())
{
EditorTag et = MultiTagManager.EditorTags.Where(t => t.Tag == tag.ToString()).FirstOrDefault();
tagger.SelectedEditorTags.Add(et);
}
}
示例2: FindGameObjectsWithTags
/// <summary>
/// Find game objects that match the given tags
/// </summary>
/// <param name="tag1">The tag name</param>
/// <param name="tag2">The tag name</param>
/// <param name="tag3">The tag name</param>
/// <param name="tagMatchType">Match tags by "Or" (any of the given tags can be selected on the object) or by "And" (all of the given tags must be selected on the object)</param>
/// <returns>A list of matching game objects</returns>
public static List<GameObject> FindGameObjectsWithTags(Tags tag1, Tags tag2, Tags tag3, TagMatch tagMatchType = TagMatch.Or)
{
List<string> temp = new List<string>() { tag1.ToString(), tag2.ToString(), tag3.ToString() };
return FindGameObjectsWithTags(temp, tagMatchType);
}