Created
February 5, 2016 23:40
-
-
Save michaelbartnett/190c26b94e071a40d499 to your computer and use it in GitHub Desktop.
particle system modules are weird
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ParticleSystem ps = GetComponent<ParticleSystem>(); | |
ps.enableEmission = false; | |
// warning CS0618: `UnityEngine.ParticleSystem.enableEmission' is obsolete: `enableEmission property is deprecated. Use emission.enable instead.' | |
ps.emission.enable = false; | |
// error CS1061: Type `UnityEngine.ParticleSystem.EmissionModule' does not contain a definition for `enable' and no extension method `enable' of type `UnityEngine.ParticleSystem.EmissionModule' could be found (are you missing a using directive or an assembly reference?) | |
ps.emission.enabled = false; | |
// error CS1612: Cannot modify a value type return value of `UnityEngine.ParticleSystem.emission'. Consider storing the value in a temporary variable | |
var emission = ps.emission; | |
emission.enabled = false; | |
ps.emission = emission; | |
// error CS0200: Property or indexer `UnityEngine.ParticleSystem.emission' cannot be assigned to (it is read only) | |
var emission = ps.emission; | |
emission.enabled = false; | |
// Because we TOTALLY expect setting a property on a struct to actually | |
// call a function on the object you got that struct from. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Best short story of the year.