Unity3D2Babylon.ExporterWindow.CreateTypescript C# (CSharp) Method

CreateTypescript() private method

private CreateTypescript ( ) : void
return void
        public static void CreateTypescript()
        {
            string path = AssetDatabase.GetAssetPath(Selection.activeObject);
            if (String.IsNullOrEmpty(path))
            {
                path = "Assets";
            }
            else if (!String.IsNullOrEmpty(Path.GetExtension(path)))
            {
                path = path.Replace(Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)), "");
            }
            string filename = Path.Combine(path, "NewTypescript.ts");
            string template = "Assets/Babylon/Templates/Scripts/typescript.template";
            if (!File.Exists(template))
            {
                string defaultTemplate = "// Babylon Typescript File";
                File.WriteAllText(template, defaultTemplate);
            }
            var icon = EditorGUIUtility.FindTexture("ScriptableObject Icon") as Texture2D;
            var DoCreateScriptAsset = Type.GetType("UnityEditor.ProjectWindowCallback.DoCreateScriptAsset, UnityEditor");
            ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance(DoCreateScriptAsset) as UnityEditor.ProjectWindowCallback.EndNameEditAction, filename, icon, template);
        }