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. Dismiss Notice

Get paths to Unity source files

Discussion in 'Editor & General Support' started by jacobrobertsbaca, Mar 31, 2020.

  1. jacobrobertsbaca

    jacobrobertsbaca

    Joined:
    Jul 17, 2018
    Posts:
    6
    I need to look at the source files in a Unity project, and I am wondering if it is possible to get paths to all the scripts in the Assets folder that will be incorporated into the built player. I know I can get all the C# scripts in the Assets folder like so:

    Code (CSharp):
    1. var scripts = AssetDatabase.FindAssets(string.Empty, new[] { "Assets" })
    2.    .Select(guid => AssetDatabase.GUIDToAssetPath(guid))
    3.    .Where(path => path.EndsWith(".cs"));

    But is it possible to get a collection containing all the scripts in the Assets folder that will end up being compiled into the player, i.e. non-editor scripts?
     
  2. jacobrobertsbaca

    jacobrobertsbaca

    Joined:
    Jul 17, 2018
    Posts:
    6