Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Feedback Please "taking notes with txt file in unity project panel" feature!

Discussion in 'Editor & General Support' started by eren332, Jul 22, 2022.

  1. eren332

    eren332

    Joined:
    Jul 22, 2022
    Posts:
    5
    We may need to leave notes to our teammates in asset files. We usually do this by creating a txt file in the windows window with the "show in explorer" option.

    But if there was an option called "right click>create>txt file" in it, it would make our job much easier.

    But the notes created in this "add notes to assets" feature must be in txt format. because we may want to look at these notes in the windows window as well.

    Please take care this feedback.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,963
    Already done long ago. Here you go.

    https://gist.github.com/kurtdekker/e63690a1bfe9515d40d3f09a1470daba

    Drop this script on any GameObjects in any scene or prefab anywhere and type away to your heart's content.

    When you want to find them, search for
    t:comments
    in the scene or prefab filter field:

    Screen Shot 2022-07-22 at 10.32.10 AM.png
     
  3. eren332

    eren332

    Joined:
    Jul 22, 2022
    Posts:
    5
  4. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    6,015
    Code (CSharp):
    1.     using System.IO;
    2.     using UnityEditor;
    3.  
    4.     public static class CreateTextFile
    5.     {
    6.         [MenuItem("Assets/Create/New Text File", priority = 100)]
    7.         private static void CreateNewTextFile()
    8.         {
    9.             string folderGUID = Selection.assetGUIDs[0];
    10.             string projectFolderPath = AssetDatabase.GUIDToAssetPath(folderGUID);
    11.             string folderDirectory = Path.GetFullPath(projectFolderPath);
    12.  
    13.             using (StreamWriter sw = File.CreateText(folderDirectory + "/NewTextFile.txt"))
    14.             {
    15.                 sw.WriteLine("This is a new text file!");
    16.             }
    17.          
    18.             AssetDatabase.Refresh();
    19.         }
    20.     }
    Bazinga.
     
    DragonCoder and Kurt-Dekker like this.
  5. eren332

    eren332

    Joined:
    Jul 22, 2022
    Posts:
    5
    Thanks for this code. But I wanted Unity to add this feature. .txt file can be created from the editor without the need to write code.
     
  6. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,963
    That's nice but I wouldn't hold my breath. Unity has a lot of ACTUAL valuable game-facing features they need to implement and they're unlikely to design, implement, test and roll out a special engine hack for something as trivial as writing a comment, which can easily be handled by a tiny little script snippet.
     
    Last edited: Jul 23, 2022
  7. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    6,015
    I'm going to go out on a limb and say using text files as in project documentation is not standard practice. Small the feature may be, it's only relevant to your particular, quirky use case.

    And you're really complaining about having to add a handful of lines of code? Unity is made to be extended, so go nuts and extend it to yourself. I have butt loads of code extending the editor to my liking.
     
  8. eren332

    eren332

    Joined:
    Jul 22, 2022
    Posts:
    5
    I'm not complaining about writing code, but the note-taking feature must come in Unity. This feature will come in the future. You will see.
     
  9. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    6,015
    Not really. I don't think this is something that should happen in engine. If you want to organise information for your team, use proper team/project management software for that.

    Add the code and move on. I'm sick of people going "waa waa waa I want Unity to add it" when they could doing themselves in less time it took to make a forum post.
     
    JoNax97 and Kurt-Dekker like this.
  10. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,963
    Seriously this. The first thing that would happen if you had basic note-taking functionality would be a whole slew of extra reports driven by the Project Manager types:

    - can they have time estimate slot?
    - can they have a checkbox for "done"
    - can they have sub-tasks?
    - can we put intra-project links in the files?
    - can we put HTML links in the files?
    - how come I clicked on a link and my Unity project is infected with malware?
    - etc

    And before long Unity isn't making a game engine. They're making JIRA or Trello or some other miserable CRM software. No thanks. If you need CRM, go use CRM software.
     
  11. eren332

    eren332

    Joined:
    Jul 22, 2022
    Posts:
    5
    Yes you are right about that :D