Closed Babiosik closed 1 year ago
Maybe need add setter for m_ParticleSystem in UIParticleAttractor or make more overridable
I have no idea how to use this component.
Hi. I'm a bit late so you may have already figured out, but I'll give an answer anyway since some people could look at this question too.
The field m_ParticleSystem in UIParticleAttractor is private and has no property, so you can't access it. However, C# has some tools to access fields, properties and other things in the namespace System.Reflection. In this case, the code would look like this:
Type type = attractor.GetType(); // Or typeof(UIParticleAttractor)
FieldInfo field = type.GetField("m_ParticleSystem", BindingFlags.NonPublic | BindingFlags.Instance);
field.SetValue(attractor, particleSystem);
If the attractor is disabled you also need to set enabled to true, but that's it.
:tada: This issue has been resolved in version 4.2.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
Hi. How I can change particle system in attractor programmatically? I need attracting many different particle systems, but this particle systems spawning in game process. And another situation when one particle system change attractor after time.