Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Get User Name in XP, Vista, Mac

Discussion in 'Scripting' started by the_gnoblin, Aug 20, 2009.

  1. the_gnoblin

    the_gnoblin

    Joined:
    Jan 10, 2009
    Posts:
    722
    Hello!

    I need to get a user name from OS to create a default profile.

    I know how to do it in Windows XP:
    Code (csharp):
    1.   user_name = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
    This returns "ComputerName\UserName".

    What's the way to do it in Mac?