private static bool TryGetAssetPath(Type type, out string path) { var attr = type.GetCustomAttribute <CreateAssetAutomaticallyAttribute>(); if (attr == null) { path = null; return(false); } path = PathUtility.EnsurePathStartsWith("Assets", attr.FullAssetPath); if (!PathUtility.ContainsFolder("Resources", path)) { path = Path.Combine(Path.GetDirectoryName(path) ?? "", "Resources", Path.GetFileName(path)); } if (!path.EndsWith(".asset")) { path += ".asset"; } return(true); }