예제 #1
0
        public static string GetFinalPath(LudiqScriptableObject asset, string @namespace, string assetName)
        {
            string fileName = string.Empty;

            var filePath = GetFilePath(asset);

            if (((ObjectMacro)asset) != null)
            {
                if (!string.IsNullOrEmpty(((ObjectMacro)asset).name))
                {
                    fileName = ((ObjectMacro)asset).name;
                }
                else
                {
                    fileName = asset.name;
                }
            }
            else
            {
                throw new NullReferenceException();
            }

            if (!string.IsNullOrEmpty(((ObjectMacro)asset).name))
            {
                return(filePath + Patcher.LegalVariableName(CodeBuilder.GetExtensionlessFileName(fileName), false) + ".cs");
            }

            return(filePath + Patcher.LegalVariableName(assetName, false) + ".cs");
        }
예제 #2
0
        public static string GetFileName(LudiqScriptableObject asset)
        {
            var path = UnityEditor.AssetDatabase.GetAssetPath(asset);

            var lastSlashIndex = path.LastIndexOf("/") + 1;
            var fileName       = path.Remove(0, lastSlashIndex);

            return(fileName);
        }