// This will be called only once at runtime and everytime script reload kicks-in in the // editor as we need to keep track of any compatible component in the project void ReloadBaseTypes() { m_ComponentsDefaultState.Clear(); // Grab all the component types we can find baseComponentTypes = CoreUtils.GetAllTypesDerivedFrom <VolumeComponent>() .Where(t => !t.IsAbstract); // Keep an instance of each type to be used in a virtual lowest priority global volume // so that we have a default state to fallback to when exiting volumes foreach (var type in baseComponentTypes) { var inst = (VolumeComponent)ScriptableObject.CreateInstance(type); m_ComponentsDefaultState.Add(inst); } }
// This will be called only once at runtime and everytime script reload kicks-in in the // editor as we need to keep track of any compatible component in the project void ReloadBaseTypes() { m_ComponentsDefaultState.Clear(); // Grab all the component types we can find baseComponentTypeArray = CoreUtils.GetAllTypesDerivedFrom <VolumeComponent>() .Where(t => !t.IsAbstract).ToArray(); var flags = System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic; // Keep an instance of each type to be used in a virtual lowest priority global volume // so that we have a default state to fallback to when exiting volumes foreach (var type in baseComponentTypeArray) { type.GetMethod("Init", flags)?.Invoke(null, null); var inst = (VolumeComponent)ScriptableObject.CreateInstance(type); m_ComponentsDefaultState.Add(inst); } }