// MIT License - Copyright (c) 2025 wallstop // Full license text: https://github.com/wallstop/unity-helpers/blob/main/LICENSE #if ZENJECT_PRESENT namespace WallstopStudios.UnityHelpers.Integrations.Zenject { using System; using WallstopStudios.UnityHelpers.Core.Helper; /// /// Controls how the Zenject integration scans the scene for relational components. /// /// /// /// // In a custom installer, if you want to bind your own options instance: /// Container.BindInstance(new RelationalSceneAssignmentOptions(includeInactive: false)); /// /// public readonly struct RelationalSceneAssignmentOptions : IEquatable { /// /// Initializes a new set of options. /// /// /// When true the initializer will scan inactive scene objects so that relational fields are /// populated even for disabled hierarchies. Defaults to true. /// /// /// When true uses a single-pass scene scan for performance (recommended). Defaults to /// true. /// public RelationalSceneAssignmentOptions(bool includeInactive, bool useSinglePassScan = true) { IncludeInactive = includeInactive; UseSinglePassScan = useSinglePassScan; } /// /// Options used when no explicit configuration is supplied. /// public static RelationalSceneAssignmentOptions Default => new(true, true); /// /// Gets whether inactive GameObjects should be included when scanning the scene. /// public bool IncludeInactive { get; } /// /// Gets whether to use a single-pass scene scan to locate relational components. /// public bool UseSinglePassScan { get; } /// public bool Equals(RelationalSceneAssignmentOptions other) { return IncludeInactive == other.IncludeInactive && UseSinglePassScan == other.UseSinglePassScan; } /// public override bool Equals(object obj) { return obj is RelationalSceneAssignmentOptions other && Equals(other); } /// public override int GetHashCode() { return Objects.HashCode(IncludeInactive, UseSinglePassScan); } /// /// Equality operator. /// public static bool operator ==( RelationalSceneAssignmentOptions left, RelationalSceneAssignmentOptions right ) { return left.Equals(right); } /// /// Inequality operator. /// public static bool operator !=( RelationalSceneAssignmentOptions left, RelationalSceneAssignmentOptions right ) { return !left.Equals(right); } } } #endif