public void Reset() { colorMode = Consts.ColorModeDefault; color = Consts.FlatColor; colorFromLight = true; intensityFromLight = true; intensityModeAdvanced = false; intensityInside = Consts.IntensityDefault; intensityOutside = Consts.IntensityDefault; blendingMode = Consts.BlendingModeDefault; shaderAccuracy = Consts.ShaderAccuracyDefault; spotAngleFromLight = true; spotAngle = Consts.SpotAngleDefault; coneRadiusStart = Consts.ConeRadiusStart; geomMeshType = Consts.GeomMeshType; geomCustomSides = Consts.GeomSidesDefault; geomCustomSegments = Consts.GeomSegmentsDefault; geomCap = Consts.GeomCap; attenuationEquation = Consts.AttenuationEquationDefault; attenuationCustomBlending = Consts.AttenuationCustomBlending; fallOffEndFromLight = true; fallOffStart = Consts.FallOffStart; fallOffEnd = Consts.FallOffEnd; depthBlendDistance = Consts.DepthBlendDistance; cameraClippingDistance = Consts.CameraClippingDistance; glareFrontal = Consts.GlareFrontal; glareBehind = Consts.GlareBehind; fresnelPow = Consts.FresnelPow; noiseMode = Consts.NoiseModeDefault; noiseIntensity = Consts.NoiseIntensityDefault; noiseScaleUseGlobal = true; noiseScaleLocal = Consts.NoiseScaleDefault; noiseVelocityUseGlobal = true; noiseVelocityLocal = Consts.NoiseVelocityDefault; sortingLayerID = 0; sortingOrder = 0; fadeOutBegin = Consts.FadeOutBeginDefault; fadeOutEnd = Consts.FadeOutEndDefault; dimensions = Consts.DimensionsDefault; tiltFactor = Consts.TiltDefault; skewingLocalForwardDirection = Consts.SkewingLocalForwardDirectionDefault; clippingPlaneTransform = Consts.ClippingPlaneTransformDefault; trackChangesDuringPlaytime = false; m_EditorDirtyFlags = EditorDirtyFlags.Everything; }
void Awake() { if (Application.isPlaying) { GenerateGeometry(); m_EditorDirtyFlags = EditorDirtyFlags.Clean; } else { // In Editor, creating geometry from Awake and/or OnValidate generates warning in Unity 2017. // So we do it from Update m_EditorDirtyFlags = EditorDirtyFlags.Props | EditorDirtyFlags.Mesh; } }
public void Reset() { colorMode = Consts.ColorModeDefault; color = Consts.FlatColor; colorFromLight = true; alphaInside = Consts.Alpha; alphaOutside = Consts.Alpha; blendingMode = Consts.BlendingModeDefault; spotAngleFromLight = true; spotAngle = Consts.SpotAngleDefault; coneRadiusStart = Consts.ConeRadiusStart; geomMeshType = Consts.GeomMeshType; geomCustomSides = Consts.GeomSidesDefault; geomCustomSegments = Consts.GeomSegmentsDefault; geomCap = Consts.GeomCap; attenuationEquation = Consts.AttenuationEquationDefault; attenuationCustomBlending = Consts.AttenuationCustomBlending; fadeEndFromLight = true; fadeStart = Consts.FadeStart; fadeEnd = Consts.FadeEnd; depthBlendDistance = Consts.DepthBlendDistance; cameraClippingDistance = Consts.CameraClippingDistance; glareFrontal = Consts.GlareFrontal; glareBehind = Consts.GlareBehind; fresnelPow = Consts.FresnelPow; noiseEnabled = false; noiseIntensity = Consts.NoiseIntensityDefault; noiseScaleUseGlobal = true; noiseScaleLocal = Consts.NoiseScaleDefault; noiseVelocityUseGlobal = true; noiseVelocityLocal = Consts.NoiseVelocityDefault; sortingLayerID = 0; sortingOrder = 0; trackChangesDuringPlaytime = false; m_EditorDirtyFlags = EditorDirtyFlags.Everything; }
void Start() { if (Application.isPlaying) { GenerateGeometry(); m_EditorDirtyFlags = EditorDirtyFlags.Clean; } else { // In Editor, creating geometry from Start and/or OnValidate generates warning in Unity 2017. // So we do it from Update m_EditorDirtyFlags = EditorDirtyFlags.Everything; } StartPlaytimeUpdateIfNeeded(); }
void Update() // EDITOR ONLY { // Handle edition of light properties in Editor if (!Application.isPlaying) { var newProps = new CachedLightProperties(lightSpotAttached); if (!newProps.Equals(m_PrevCachedLightProperties)) { m_EditorDirtyFlags |= EditorDirtyFlags.Props; } m_PrevCachedLightProperties = newProps; } if (m_EditorDirtyFlags == EditorDirtyFlags.Clean) { if (Application.isPlaying) { if (!trackChangesDuringPlaytime) // during Playtime, realtime changes are handled by CoUpdateDuringPlaytime { return; } } } else { if (m_EditorDirtyFlags.HasFlag(EditorDirtyFlags.Mesh)) { if (m_EditorDirtyFlags.HasFlag(EditorDirtyFlags.BeamGeomGAO)) { DestroyBeam(); } GenerateGeometry(); // regenerate everything } else if (m_EditorDirtyFlags.HasFlag(EditorDirtyFlags.Props)) { ValidateProperties(); } } // If we modify the attached Spotlight properties, or if we animate the beam via Unity 2017's timeline, // we are not notified of properties changes. So we update the material anyway. UpdateAfterManualPropertyChange(); m_EditorDirtyFlags = EditorDirtyFlags.Clean; }
public void Reset() { color = Color.white; colorFromLight = true; alphaInside = Consts.Alpha; alphaOutside = Consts.Alpha; spotAngleFromLight = true; spotAngle = Consts.SpotAngleDefault; coneRadiusStart = Consts.ConeRadiusStart; geomSides = Consts.GeomSidesDefault; geomCap = Consts.GeomCap; fadeEndFromLight = true; fadeStart = Consts.FadeStart; fadeEnd = Consts.FadeEnd; depthBlendDistance = Consts.DepthBlendDistance; cameraClippingDistance = Consts.CameraClippingDistance; glareFrontal = Consts.GlareFrontal; glareBehind = Consts.GlareBehind; fresnelPow = Consts.FresnelPow; noiseEnabled = false; noiseIntensity = Consts.NoiseIntensityDefault; noiseScaleUseGlobal = true; noiseScaleLocal = Consts.NoiseScaleDefault; noiseVelocityUseGlobal = true; noiseVelocityLocal = Consts.NoiseVelocityDefault; trackChangesDuringPlaytime = false; m_EditorDirtyFlags = EditorDirtyFlags.Props | EditorDirtyFlags.Mesh; }
void OnValidate() { m_EditorDirtyFlags |= EditorDirtyFlags.Props; // Props have been modified from Editor }