Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Maart on November 28, 2020, 07:58:40 AM

Title: SOLVED Access component from spawned object
Post by: Maart on November 28, 2020, 07:58:40 AM
Hi i need some help trying to do the following.
I spawn a prefab using create object. This object has a (textmesh) component that I want to manipulate. Simce it's a spawned object I cannot use something like set property from scene. I can create an object variable that holds the textmesh component. How do I assign it to the created prefab? I vaguely remember using something like set component,in the past, I can't seem to find it. Is it removed or is my mind playing tricks on me?



SOLVED
Nevermind I found the solution trough the actions "Get Component" and "set property" and creating an unityobject variable and setting it to the right ObjectType
Title: Re: Access component from spawned object
Post by: djaydino on November 28, 2020, 09:20:45 AM
Hi.
On the prefab you can have a fsm with the component in a variable (to place the variable you can drag and drop the component in the variable tab, itwill create automatically)

Call the fsm for example 'Data'

Then when you create the object, store it in a variable and use 'Get Fsm Object'
Target the stored prefab's 'Data' fsm. and the corresponding name

try minimize using Get/Set Property.

if you need actions for text mesh, maybe these can help :
https://hutonggames.com/playmakerforum/index.php?topic=15008.msg69460#msg69460
Title: Re: Access component from spawned object
Post by: Maart on November 28, 2020, 11:16:20 AM
would it be better (more efficient) to send a variable and an event to the generated prefab than using get/set properties?