public bool Resolve(Warning warning) { var matchWarning = MatchWarning.Match(warning.Source); if (matchWarning.Success) { var matchClass = MatchClass.Match(matchWarning.Value); if (matchClass.Success) { var className = matchClass.Value.TrimStart('\'').TrimEnd('.'); var script = AssetDatabase.LoadAssetAtPath <MonoScript>(warning.Line.File.FilePath); Type clazz; if (script != null && (clazz = script.GetClass()) != null) { var fieldInfo = clazz.GetField(warning.MemeberName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); if (fieldInfo != null && !fieldInfo.IsStatic) { if (fieldInfo.IsPublic || fieldInfo.GetCustomAttribute <SerializeField>() != null) { return(warning.DisableWarning("649")); } } } else { var ok = warning.Line.Text.IndexOf("public ") != -1 && warning.Line.Text.IndexOf("public ") < warning.StartPosition; ok = ok || warning.Line.Text.Contains("[SerializeField]"); ok = ok || warning.Line.Line.Prev != null && warning.Line.Line.Prev.Text.Contains("[SerializeField]"); if (ok) { return(warning.DisableWarning("649")); } } } } return(false); }
public bool Resolve(Warning warning) { return(warning.DisableWarning("219")); }