playMaker

Author Topic: Working with prefabs and actions (SOLVED, more or less)  (Read 1241 times)

ingumak

  • Playmaker Newbie
  • *
  • Posts: 20
Working with prefabs and actions (SOLVED, more or less)
« on: September 16, 2017, 03:40:19 AM »
Hi again :D

I think my problem  is very simple, but maybe, from my poor english, I can´t find what I need to solve. I think I don´t know look for it properly.

I don´t undertand very well how works the prefabs with the actions or unity in this case. I have a simple example:

I have created a big window.
For testing I am using the FPS controller of Unity.
When I am near the window, a clickable  icon appears.
When I click down, the window opens.

Ok. All of this works fine. To open de window I have created a controller in a "empty object".

When de icon is active I use "Mouse Pick Event". Then I use bool variable to active the animation of the window, using "Set animator Bool" on the game object "window".

How I have said, all works fine.

But I need more windows and if I put another prefab of the window in my scene, the new window doesn´t work. The button appear but when I try click it doesn´t work. (The first window still working fine).

I think it happen because in the actions I´m calling a specify object in "Set animation Bool" and the same thing for the "mouse pick event". And it doesn´t work with the another copy of the prefab (Because the prefab is another different object. Isn´t it?).

And maybe I have to use game object variable or any variable to identify what object I want to interact. Or something like this.

Now. Where can I find any tutorial to know what is the best way to do this?

I think is a very simple question (maybe), but I can´t find the answer.

Sorry for my long post. Thanks!!!
« Last Edit: September 16, 2017, 04:01:17 AM by ingumak »

ingumak

  • Playmaker Newbie
  • *
  • Posts: 20
Re: Working with prefabs and actions
« Reply #1 on: September 16, 2017, 04:00:04 AM »
Hi again,

I have solved this putting the actions into the button  to open the window and changing the hierarchy of my game object.

But I think it is better to do this from a out controller, because now I will have actions in each of windows, and I thought was better if I can control all of them fron a unique controller, isn´t it?

But, al least is working... for now hahahaha! :D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Working with prefabs and actions (SOLVED, more or less)
« Reply #2 on: September 19, 2017, 02:53:31 AM »
Hi,

 you mean all of this is done with the Unity UI right?

 bye,

 Jean