File tree Expand file tree Collapse file tree 3 files changed +42
-1
lines changed
TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests
com.unity.visualeffectgraph Expand file tree Collapse file tree 3 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,34 @@ public void CheckAttributes()
161161 Assert . IsFalse ( data . IsCurrentAttributeWritten ( attrib3 ) ) ;
162162 Assert . IsTrue ( data . IsCurrentAttributeWritten ( attrib4 ) ) ;
163163 }
164+
165+ [ Test ]
166+ public void CheckCapacityCannotBeZero ( )
167+ {
168+ var init = ScriptableObject . CreateInstance < ContextTestInit > ( ) ;
169+ var data = init . GetData ( ) ;
170+ data . SetSettingValue ( "capacity" , 0u ) ;
171+ uint capacity = ( uint ) data . GetSettingValue ( "capacity" ) ;
172+ Assert . NotZero ( capacity ) ;
173+ }
174+
175+ [ Test ]
176+ public void CheckStripCapacityCannotBeZero ( )
177+ {
178+ var init = ScriptableObject . CreateInstance < ContextTestInit > ( ) ;
179+ var data = init . GetData ( ) ;
180+ data . SetSettingValue ( "dataType" , VFXDataParticle . DataType . ParticleStrip ) ;
181+ data . SetSettingValue ( "stripCapacity" , 0u ) ;
182+ data . SetSettingValue ( "particlePerStripCount" , 0u ) ;
183+
184+ uint capacity = ( uint ) data . GetSettingValue ( "capacity" ) ;
185+ uint stripCapacity = ( uint ) data . GetSettingValue ( "stripCapacity" ) ;
186+ uint particlePerStripCount = ( uint ) data . GetSettingValue ( "particlePerStripCount" ) ;
187+
188+ Assert . NotZero ( capacity ) ;
189+ Assert . NotZero ( stripCapacity ) ;
190+ Assert . NotZero ( particlePerStripCount ) ;
191+ }
164192 }
165193}
166194#endif
Original file line number Diff line number Diff line change @@ -4,6 +4,11 @@ All notable changes to this package will be documented in this file.
44The format is based on [ Keep a Changelog] ( http://keepachangelog.com/en/1.0.0/ )
55and this project adheres to [ Semantic Versioning] ( http://semver.org/spec/v2.0.0.html ) .
66
7+ ## [ Unreleased]
8+
9+ ### Fixed
10+ - Prevent capacity from being 0 [ Case 1233044] ( https://issuetracker.unity3d.com/product/unity/issues/guid/1233044/ )
11+
712## [ 9.0.0] - 2020-07-09
813
914### Added
Original file line number Diff line number Diff line change @@ -195,7 +195,7 @@ class VFXDataParticle : VFXData, ISpaceable
195195 {
196196 public override VFXDataType type { get { return hasStrip ? VFXDataType . ParticleStrip : VFXDataType . Particle ; } }
197197
198- protected enum DataType
198+ internal enum DataType
199199 {
200200 Particle ,
201201 ParticleStrip
@@ -215,6 +215,14 @@ protected enum DataType
215215 protected override void OnSettingModified ( VFXSetting setting )
216216 {
217217 base . OnSettingModified ( setting ) ;
218+
219+ if ( setting . name == "capacity" && capacity == 0 )
220+ capacity = 1 ;
221+ else if ( setting . name == "stripCapacity" && stripCapacity == 0 )
222+ stripCapacity = 1 ;
223+ else if ( setting . name == "particlePerStripCount" && particlePerStripCount == 0 )
224+ particlePerStripCount = 1 ;
225+
218226 if ( hasStrip )
219227 {
220228 if ( setting . name == "dataType" ) // strip has just been set
You can’t perform that action at this time.
0 commit comments