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.

What is #NOTRIM# for ? And using other MonoBehaviour template built-in magic variables.

Discussion in 'Scripting' started by AlanMattano, Apr 17, 2017.

  1. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,500
    I can understand what is: #SCRIPTNAME# for.
    But I do not know #NOTRIM# is it for.
    Are there more #FUNCTIONS# ? where to find them?
    http://stackoverflow.com/questions/39461801/unity-add-default-namespace-to-script-template

    Here is an example using #NOTRIM# inside a Unity default template 81 C# NewBehaviour Script
    https://gist.github.com/apkd/c111a0aba58500225c80e3ca4af9ef3d

    A short answer from https://support.unity3d.com/hc/en-us/articles/210223733-How-to-customize-Unity-script-templates

    What is this NOTRIM for and how to use it?
     
    Last edited: Apr 19, 2017
  2. AlanMattano

    AlanMattano

    Joined:
    Aug 22, 2013
    Posts:
    1,500
    Does anybody know #NOTRIM# what is it for? Is inside the C# template.
     
  3. BlackPete

    BlackPete

    Joined:
    Nov 16, 2016
    Posts:
    970
    I'm not sure either. I'm guessing that it's there to prevent empty lines from being deleted depending on your operating system.

    It doesn't seem useful to me on a PC, so I don't bother using it. It might be more useful on a MacOS system, but I have no way to verify this theory.
     
  4. UnityCoach

    UnityCoach

    Joined:
    Mar 9, 2015
    Posts:
    5
    It doesn't seem to have any effect on MacOS either.
    I just tested with Unity 5.6.1 and MonoDevelop 5.9.6.
     
  5. JoshuaMcKenzie

    JoshuaMcKenzie

    Joined:
    Jun 20, 2015
    Posts:
    897
    You just answered your own question in your first post....

    In the MonoBehaviour template it preserves the indenting inside the empty functions. the auto-trimming of white-space may be platform or IDE specific, so #NOTRIM# likely can help standardize that. so that the intended behavior is consistent. Honestly #NOTRIM# is likely a noop. but simply cause its there it indirectly prevents the parser from clearing that line.


    Thats all its for. automatically setting indentation within the function.
     
    AlanMattano and Ryiah like this.