Example #1
0
        public static List <IssueRecord> CheckSceneSettingsForMissingReferences(AssetInfo sceneAsset)
        {
            var result = new List <IssueRecord>();

            var sceneSettingsObject = CSSettingsTools.GetInSceneLightmapSettings();

            if (sceneSettingsObject != null)
            {
                var initialInfo = new SerializedObjectTraverseInfo(sceneSettingsObject);
                CSTraverseTools.TraverseObjectProperties(initialInfo, (info, property) =>
                {
                    if (MissingReferenceDetector.IsPropertyHasMissingReference(property))
                    {
                        var record = SceneSettingsIssueRecord.Create(SceneSettingsKind.LightmapSettings, IssueKind.MissingReference, sceneAsset.Path, property.propertyPath);
                        result.Add(record);
                    }
                });
            }

            sceneSettingsObject = CSSettingsTools.GetInSceneRenderSettings();
            if (sceneSettingsObject != null)
            {
                var initialInfo = new SerializedObjectTraverseInfo(sceneSettingsObject);
                CSTraverseTools.TraverseObjectProperties(initialInfo, (info, property) =>
                {
                    if (MissingReferenceDetector.IsPropertyHasMissingReference(property))
                    {
                        var record = SceneSettingsIssueRecord.Create(SceneSettingsKind.RenderSettings, IssueKind.MissingReference, sceneAsset.Path, property.propertyPath);
                        result.Add(record);
                    }
                });
            }

            return(result);
        }
Example #2
0
        private static void CheckLightMapSettings(TreeConjunction conjunction, int candidateInstanceId)
        {
            lightmapSettings = lightmapSettings ? lightmapSettings : CSSettingsTools.GetInSceneLightmapSettings();

            if (lightmapSettings == null)
            {
                return;
            }

            lightmapSettingsSo      = lightmapSettingsSo ?? new SerializedObject(lightmapSettings);
            lightmapParametersField = lightmapParametersField ??
                                      lightmapSettingsSo.FindProperty(
                "m_LightmapEditorSettings.m_LightmapParameters");
            if (lightmapParametersField != null && lightmapParametersField.propertyType ==
                SerializedPropertyType.ObjectReference)
            {
                if (lightmapParametersField.objectReferenceInstanceIDValue == candidateInstanceId)
                {
                    var entry = new ReferencingEntryData
                    {
                        location    = Location.SceneLightingSettings,
                        prefixLabel =
                            "Lighting settings (Scene tab > Lightmapping Settings > Lightmap Parameters)"
                    };

                    conjunction.referencedAtInfo.AddNewEntry(entry);
                }
            }
            else
            {
                Debug.LogError(
                    Maintainer.ConstructError(
                        "Can't find m_LightmapParameters at the LightmapSettings!"));
            }
        }
Example #3
0
        private Object GetSettingsObjectWithThisIssue()
        {
            Object result;

            switch (SettingsKind)
            {
            case SceneSettingsKind.LightmapSettings:
                result = CSSettingsTools.GetInSceneLightmapSettings();
                break;

            case SceneSettingsKind.RenderSettings:
                result = CSSettingsTools.GetInSceneRenderSettings();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(result);
        }