playMaker

Author Topic: Template reference and Global reference to hierarchy gameobjects[SOLVED]  (Read 2782 times)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Hi,
I wanted to use a template for some enemy behavior but i have a refference to a "Enemy Manger" GameObject which holds several array list.

But this breaks because the template thinks its a prefab and Can't refer to hierarchy objects.

So then i thought to make a global and reference that, but there i cant drop them in neither

even if one of the 2 would work, it would enhance the template a lot.

Another possibility would be to have the ability to place a template inside an fsm
as if it was a state, similar to grouping a bunch of states (another requested feature)

also for Globals this would be very nice as you could easier set references using its global variable instead of dragging and dropping the gameobject
« Last Edit: September 11, 2017, 02:20:40 AM by jeanfabre »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Template reference and Global reference to hierarchy gameobjects
« Reply #1 on: September 06, 2017, 05:14:01 AM »
Hi Kurt :)

yeah you can't reference scene objects in a template that you'll run using runfsm, but using global variables works, can you show me with screenshots or screencast what's wrong? my tests worked.

 Bye,

 Jean

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Template reference and Global reference to hierarchy gameobjects
« Reply #2 on: September 06, 2017, 11:12:09 AM »
Hi jean :)

Global variables work except for "gameobject" variable i can't drop in a gameobject from the hierarchy

For the template i am not using run fsm, but i place them in an fsm
and it has a local int variable that has 'inspector' checked and i set a index number for each object.

Then that index number is used to get info from several arraylist arrays, on a 'array manager' fsm.

But i found a work around and already to solve this.
by getting the gameobject @runtime

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Template reference and Global reference to hierarchy gameobjects
« Reply #3 on: September 07, 2017, 05:15:32 AM »
Hi,

 yes, because you can't reference a GameObject of a scene inside an asset that doesn't reside in the scene.

 the only way is that if you use this template to run an entire fsm, expose this as inspector and wire these gameobjects then via the inspector on the instances inside your hierarchy, OR set them up at runtime using logic.

Bye,

 Jean

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Template reference and Global reference to hierarchy gameobjects
« Reply #4 on: September 07, 2017, 08:09:56 PM »
Hi,
Ah yes, that would indeed break the global.

Anyway i have set it up with some logic @ runtime
to make it easier to duplicate for my client and still be able to change things inside the template when needed :)