playMaker

Author Topic: Cant set constraints property of instanced prefab! [SOLVED]  (Read 2288 times)

PaulH

  • Junior Playmaker
  • **
  • Posts: 50
Hi all

so here's the problem.

1. i instantiate/instance/create a object from a prefab,
2. i want to then at some point freeze constraints of that instance when a button is pressed, so i do a set property action (rigidbody/freeze constraints) on the prefab which (as im lead to believe) should work fine at runtime.

now heres the problem, at runtime, i press the button but the freeze constraints doesnt work on that instance,

its only after that instance has been destroyed and a new one created that the freeze constraints then works (without the button being pressed again),  because when that following instance is created its locked in place and when i look at the inspector, the freeze constraints check-marks for that object have been turned on so its definitely getting through, (just not on the object straight away as its supposed to, only on the following instance). cant understand why.

anyone know why and how to fix?

many thanks.

...OK to simplify this, please can someone tell me how i set the constraint (freeze and unfreeze) property of an instantiated/instanced (from a prefab) object at run-time?

i cant for the life of me figure it out and this should be so easy...sigh...

(edited)
« Last Edit: May 13, 2014, 11:34:41 AM by Alex Chouls »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Cant set constraints property of instanced prefab!
« Reply #1 on: May 12, 2014, 09:28:56 PM »
It sounds like you're setting the property on the prefab instead of the instance.

To set the property on a dynamically created instance you should use Get Component then Set Property.

There's a YouTube video showing how to do this:




« Last Edit: May 12, 2014, 09:30:32 PM by Alex Chouls »

PaulH

  • Junior Playmaker
  • **
  • Posts: 50
Re: Cant set constraints property of instanced prefab!
« Reply #2 on: May 13, 2014, 06:05:48 AM »
hey Alex

yeh i found the vid last night, just what i needed!

cheers

Paul.