Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: PaulH on May 12, 2014, 04:09:36 PM

Title: Cant set constraints property of instanced prefab! [SOLVED]
Post by: PaulH on May 12, 2014, 04:09:36 PM
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)
Title: Re: Cant set constraints property of instanced prefab!
Post by: Alex Chouls 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:




Title: Re: Cant set constraints property of instanced prefab!
Post by: PaulH on May 13, 2014, 06:05:48 AM
hey Alex

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

cheers

Paul.