/// <summary> /// This helper checks whether the passed node is the GameObject.Tag type /// </summary> /// <param name="context">Analyzer context</param> /// <param name="node">node to analyze for GameObject.Tag</param> /// <returns>true if it is GameObject.tag, false otherwise</returns> private static bool IsGameObjectTagProperty(ref SyntaxNodeAnalysisContext context, ExpressionSyntax node) { const string GameObjectTag = "UnityEngine.GameObject.tag"; const string ComponentTag = "UnityEngine.Component.tag"; var prop = context.SemanticModel.GetSymbolInfo(node).Symbol as IPropertySymbol; if (prop != null) { return(GameObjectTag.Equals(prop.ToString()) || ComponentTag.Equals(prop.ToString())); } return(false); }