playMaker

Author Topic: Prefabs, Templates and Get/Set Property issues... help please?  (Read 2759 times)

Red

  • Hero Member
  • *****
  • Posts: 563
Hey there!

I've got a system where I need to gain access to one of the object's properties and since i'm working with a lot of them I need to use the templates to ensure that they're all uniform.

What it is is a system to communicate damage and give a visual feedback much like those "numbers floating upwards" kind of effect.

this is using NGUI too but so far i've been able to narrow down that that in itself isnt' where the issue lies... the issue is that I need to reach in and set the property of the text to the value that I want to pass it... and this works when they're all unique and not using templates... but i've been trying to use the "Get component" action as that seems to be the right action to use to be able to fetch the component that I need to access because as a template, it only lets me hard-code this value in as far as i've been able to tell.

If i need to make them all individuals then I will but i'd like to use the template system because this is one case where it's literally made to be awesome in handling... and since i may have to have upwards of 30 of these assets to juggle, having them all using templates is the way i would like to go as having to manage all these FSMs would be a pain in the butt and increase the likelihood of errors cropping up.

EDIT:: Additional testing has shown me that the get component only seems to have the capacity to get the first component which results in the object variable (which i create and expose in the inspector to verify) as being only resulting with UnityEngine.Object... and when i open that drop-down to find the appropriate component classification it doesn't show me the right kind of component it is that I'm looking for... also, the only NGUI related components aren't listing the script i need (and there isn't an option that I can see that let's me tell it to only look for an attached script which in this case alone I assume would suffice but am not sure how that'd work with an object that has multiple scripts on it.)
« Last Edit: August 09, 2013, 07:20:18 PM by Red »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15620
  • Official Playmaker Support
Re: Prefabs, Templates and Get/Set Property issues... help please?
« Reply #1 on: August 12, 2013, 07:30:59 AM »
Hi,

 I am not sure where your issue is, but the following might help:

-- if you have more than one similar component on the same gameObject, Unity will pick the first one, that's not something PlayMaker can have control over. simply do not have twice the same component if you are planning on a framework using templates that access a gameobject to get to a particular component programmatically. That would be one "rule" for your system to work. and that's fine. I hardly ever need two similar component, especially within ngui and other 2d framework.

-- are you properly setting your FsmObject initial type? if you are doing all this within fsm logic, getting a component from a gameobject will only be useful if you make it of the right type in the FsmObject that will receive it.

else, can you elaborate with a concrete example?I'll then come up with something.

bye,

Jean