playMaker

Author Topic: Get Component / Set Property only working once  (Read 2314 times)

Horror

  • Junior Playmaker
  • **
  • Posts: 79
Get Component / Set Property only working once
« on: December 06, 2012, 05:15:13 AM »
Not sure if this is a bug or intended functionality but I don't seem to be able to store a component as a variable and set its properties multiple times.

I have an enemy that uses a capsule collider, but when it gets shot and knocked back I destroy the capsule and add a box collider instead, storing it as an object variable and using Set Property to apply the correct dimensions. (This is so the enemy falls flat on its back instead of rolling around when it hits the ground)

The setup works fine the first time the enemy dies, but when I respawn it (using PoolManager), setting the property on the component has no effect. The object value of the variable appears to be set correctly when everything starts going wrong, but maybe it's still storing the component that I destroyed on the first run through and which no longer exists?

There's either something going wrong with Get Component or Set Property.

EDIT: Solved this by creating a child game object with it's own collider and switching it on and off with Set Property when needed; so its more likely that there is an issue with Get Component.
« Last Edit: December 06, 2012, 06:00:53 AM by Horror »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Get Component / Set Property only working once
« Reply #1 on: December 06, 2012, 01:59:23 PM »
Are you using the latest version of Playmaker (1.4.4 in about box)? There was a caching bug in an older version, but I thought we squashed it...

Horror

  • Junior Playmaker
  • **
  • Posts: 79
Re: Get Component / Set Property only working once
« Reply #2 on: December 07, 2012, 01:38:28 AM »
Updated to 1.4.4f3 yesterday (before that, when Unity 4 was released). I forget if this was happening before or after I updated.

I just created a test game object that continuously creates, destroys and modifies a box and capsule collider but I wasn't able to reproduce the problem. It worked as expected.