playMaker

Author Topic: help with prefabs  (Read 2193 times)

mutoit

  • Playmaker Newbie
  • *
  • Posts: 25
help with prefabs
« on: February 04, 2018, 03:55:51 AM »
hello , i have this :
1 my 3d model
2 my FSM, (just trigger to display something) and destroy action for finish.

My first problem, i want to make a lot of copies of this model ,when player active this " destroy " , all of this objects are erased,all,not just the activated.

How i can make copies ?¿ if i put the prefab in scene, he lose links, if i duplicate, all have the same behavior.

In real, i dont know how to work fine with prefabs, coz they lose the reference to objects in scene etc....

Thz


Kathar

  • Playmaker Newbie
  • *
  • Posts: 48
Re: help with prefabs
« Reply #1 on: February 04, 2018, 05:10:38 AM »
Might be the way your FSM is set up, in reality once a prefab is 'created' its behaviour should be independent from any other instance of the prefab, so destroying one shouldn't destroy them all. Though if in your FSM they are all referencing a global variable or something that tells them to destroy themselves, that might cause them all to get destroyed at once. It might be good to post a screenshot of your FSM set up, just so we can help you a bit better

mutoit

  • Playmaker Newbie
  • *
  • Posts: 25
Re: help with prefabs
« Reply #2 on: February 04, 2018, 09:06:03 AM »

Kathar

  • Playmaker Newbie
  • *
  • Posts: 48
Re: help with prefabs
« Reply #3 on: February 04, 2018, 10:32:53 AM »
Without seeing all of the actions in each of the states, my guess would be that it's because the GetKeyDown will be getting triggered on all of the objects at the same time when that key is pressed, as it's not an object-specific event. It depends exactly on what you're trying to do, but if you don't have one already, you'll need some other check/method to ensure only the desired object gets activated/deleted when that key is pressed (Like an On Collision/Trigger Enter event first or something)

mutoit

  • Playmaker Newbie
  • *
  • Posts: 25
Re: help with prefabs
« Reply #4 on: February 04, 2018, 10:51:13 AM »
i have no idea how to do....
Is just an object to farm...u can recollect. But, i want a lot of this, and after recollected, destroy that item....
Maybe i need a more complex code ?¿

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: help with prefabs
« Reply #5 on: February 04, 2018, 07:44:41 PM »
hi.
indeed the get key down would be the issue as it will trigger on all objects which uses the same keys.
For what platform are you making your projects?

btw i noticed that you where using a "Set Property" action to set the ui text.
You should avoid using Get/Set properties action they are mend to be used for 3rd party assets which have no playmaker support/actions.

You can get actions for the UI (and many custom actions) on the Ecosystem
Search for 'Ugui Proxy Full' and import the package.

mutoit

  • Playmaker Newbie
  • *
  • Posts: 25
Re: help with prefabs
« Reply #6 on: February 04, 2018, 10:41:13 PM »
hello , thz.
For Pc.
Maybe that E was a problem yes, now I have been able to fix it,and i can copi the item , all working.
I dont know this problem with set ui ,I am going to try this Ugui proxy.

Thz !

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: help with prefabs
« Reply #7 on: February 05, 2018, 01:52:43 AM »
Hi.
When you build you game you can have issues with get/set property actions.
To prevent this you need to use the Linker Wizard
Also it works slower and you would have more data needed (means bigger file)

mutoit

  • Playmaker Newbie
  • *
  • Posts: 25
Re: help with prefabs
« Reply #8 on: February 05, 2018, 10:25:05 AM »
ok thannk you !