A utility that helps initializing new unity projects.
- Open "Package Manager"
- Choose "Add package from git URL..."
- Use the HTTPS URL of this repository:
4. Enter `https://github.com/yanicksenn/com.yanicksenn.projectinitializer.git`
- Click "Add"
The project initializer helps setting up a new project by creating a standard folder structure, installing common packages and copying resources.
The violation scanner helps keeping the project clean by enforcing naming conventions and folder structures.
- Open the project initializer window via
Tools/Project Setup/Initialize Project - Select the folders to create
- Select the packages to install
- Select the resources to copy
- Click Initialize Project
- Open the violation scanner window via
Tools/Project Setup/Violation Scanner - Click Scan for Violations
- Select the violations to fix
- Click Fix Selected
You can extend the violation scanner by creating custom detectors and handlers.
Create a class that implements IViolation to hold the violation data.
public class MyCustomViolation : IViolation {
public string Title => "My Custom Violation";
public string SubTitle => "Asset Path";
public string Description => "This asset violates a custom rule.";
public bool IsSelected { get; set; }
// Add custom data properties here
public string AssetPath { get; set; }
}Implement IViolationDetector and add the [ViolationDetector] attribute.
[ViolationDetector]
public class MyCustomViolationDetector : IViolationDetector {
public IEnumerable<IViolation> Detect() {
// Logic to find violations
yield return new MyCustomViolation {
AssetPath = "Assets/SomeFile.txt"
};
}
}Implement IViolationHandler and add the [ViolationHandler] attribute targeting your violation type.
[ViolationHandler(typeof(MyCustomViolation))]
public class MyCustomViolationHandler : IViolationHandler {
public void Fix(IViolation violation) {
if (violation is MyCustomViolation myViolation) {
// Logic to fix the violation
Debug.Log($"Fixing {myViolation.AssetPath}");
}
}
}