# SourceLocation

> Identifies a specific part of a source code file.

## Definition

* **Type:** Struct
* **Namespace:** [UnityEditor.ShaderApiReflection](/engine/6000.5/script-reference/unityeditor/shaderapireflection.md)
* **Assembly:** UnityEditor.CoreModule

```csharp
public struct SourceLocation
```

## Remarks

When used with a [LogMessage](/engine/6000.5/script-reference/unityeditor/shaderapireflection/logmessage.md), represents the location in the source code the message refers to.

Additional Resources: [LogMessage.Location](/engine/6000.5/script-reference/unityeditor/shaderapireflection/logmessage/location.md).

## Examples

```csharp
using UnityEditor;
using UnityEditor.ShaderApiReflection;
using UnityEngine;

// This example adds a menu item which re-logs any reflection errors reported by shader includes
// selected in the project view.
public class ShaderIncludeReflectionErrorPrinter
{
    [MenuItem("Examples/ShaderIncludeReflectionErrorPrinter")]
    static void PrintErrors()
    {
        // Visit each selected object
        foreach (Object selectedObject in Selection.objects)
        {
            // Check if the object is a ShaderInclude
            if (selectedObject is ShaderInclude includeObject)
            {
                // Re-log each reflection message
                foreach (LogMessage message in includeObject.Reflection.LogMessages)
                {
                    string formattedMessage =
                        $"{message.ErrorCode} {message.MessageSeverity} at {message.Location.FilePath}"
                        + $" (line {message.Location.Line}): {message.Text}";
                    if (message.MessageSeverity == LogMessage.Severity.Error)
                        Debug.LogError(formattedMessage);
                    else
                        Debug.LogWarning(formattedMessage);
                }
            }
        }
    }
}
```

## Properties

| Property                                                                                               | Description                                      |
| ------------------------------------------------------------------------------------------------------ | ------------------------------------------------ |
| [FilePath](/engine/6000.5/script-reference/unityeditor/shaderapireflection/sourcelocation/filepath.md) | The project-relative path to a source code file. |
| [Line](/engine/6000.5/script-reference/unityeditor/shaderapireflection/sourcelocation/line.md)         | The line number within a source code file.       |
