Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Suggestion / Idea  [Workaround] Setting target at runtime for ObiParticleAttachment
#4
(27-03-2020, 06:41 PM)Chess Wrote: Hi Guys,

I'm working on ObiParticleAttachment at runtime too. After made some tries I spotted something weird.
I procedurally generate a rope and its blueprint, then I add an ObiParticleAttachement on my rope and assign the target and the particle group by script.

In the ObiParticleAttachment component generated, everything seems good but my rope still not attached to my target.
So I looked for the reason, the issue seems be when I set my particleGroup to the attachment by      
  
Code:
attachment.particleGroup = rope.blueprint.groups[0];

In the particlegroup set accessor inside ObiParticleAttachment.cs the new value is assigned after the Bind method, so the script doesn't go through. 
I've fixed that simply by set the value before the bind()

Code:
           set
           {
               if (value != m_ParticleGroup)
               {
                   Disable(m_AttachmentType);
                   m_ParticleGroup = value;
                   Bind();
                   UpdateEnabledState();
               }
           }

However I didn't try if this correction could cause some issues elsewhere. For my case, it's working now !

Your code is 100% correct. Note that this has been fixed in 5.2 (and the code is identical to yours).
Reply


Messages In This Thread
RE: [Workaround] Setting target at runtime for ObiParticleAttachment - by josemendez - 28-03-2020, 10:21 AM