playMaker

Author Topic: Prefab reference to Global Variable - Playmaker ruined the project  (Read 2920 times)

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
I know that Unity have some weird restriction for Prefab referencing to Scene Objects... But, I have a global variable that referencing to scene objects and I use it in prefabs and everything works fine. I save and load project, open different scenes, build it and it works perfectly. Except when Playmaker realize that I'm referencing to scene objects with this variables it flooded me with tons of red alerts and all this alarm mood.

What am I doing wrong? I mean, if the referencing to scene objects from prefab really works this way, why can't I do it?

And is it possible to ask Playmaker stop the panic?
I found the option "Check for prefab restriction" and looks like the panic level goes down. But I'm still interested why is it wrong and should I care? Did it already sent a complain to Unity's headquarter: someone use me in a prohibited way?
« Last Edit: February 11, 2018, 02:36:46 PM by nFighter »
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Prefab reference to Global Variable
« Reply #1 on: February 11, 2018, 07:21:25 AM »
Hi.
Can you show some images or a video from your prefab fsm / the global used and scene fsm that sets the gameobject to the global.
And from the errors you are getting.

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: Prefab reference to Global Variable
« Reply #2 on: February 11, 2018, 02:13:28 PM »
Sure. Here I define the global variables.


And here is a prefab referencing to it
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: Prefab reference to Global Variable
« Reply #3 on: February 11, 2018, 02:36:13 PM »
And now the most interesting part: Playmaker ruined my whole project somehow!

1. One of my global variables was renamed without my intention. If you check the screenshots from my last post you can see a variable CharShape and that's not what I did. I have 4 variables started with A_ and 4 started with B_. Now one of the A_ renamed to CharShape. (Is it even possible to rename Global Variable? I don't know how to do it, but playmaker just did)

2. In some places of the project Playmaker create local variable with the same name and reference to it. Not everywhere, just in some random places. Look, it's local now. Yesterday it was a global and it name was different. It was one of the  "A_".

3. Yesterday I did many tests with save/load scene, exit/start unity and building the project. It was working perfectly, today it's totally ruined. What's going on an how it's even possible? Is it penalty from Unity's headquarter for misusing the global variables?
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

antibob

  • Playmaker Newbie
  • *
  • Posts: 24
    • BillsClass
Re: Prefab reference to Global Variable - Playmaker ruined the project
« Reply #4 on: February 11, 2018, 05:17:55 PM »
If you think P.M. killed your project, delete any Playmaker reference in your project folder and reinstall P.M.

It's best to connect prefabs with game objects (and variables) by finding GameObject dynamically by name or tag.

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Prefab reference to Global Variable - Playmaker ruined the project
« Reply #5 on: February 11, 2018, 09:37:28 PM »
Backup the project before you delete anything. Which version of unity and playmaker are you currently using?

nFighter

  • Beta Group
  • Full Member
  • *
  • Posts: 174
    • multiplayer adult fighting
Re: Prefab reference to Global Variable - Playmaker ruined the project
« Reply #6 on: February 11, 2018, 11:45:05 PM »
I'm using Unity 2017.3.0f3 and Playmaker 1.8.5

For now I just eliminate most of my Prefabs and working directly with cloning objects in scene. I don't understand what's happened but will avoid using PM with prefabs as much as possible  :-\
indie developer of multiplayer adult fighting
http://nakedfighter3d.com

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Prefab reference to Global Variable - Playmaker ruined the project
« Reply #7 on: February 12, 2018, 04:07:12 AM »
Hi,
Maybe this tutorial can help you :


jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Prefab reference to Global Variable - Playmaker ruined the project
« Reply #8 on: February 22, 2018, 05:23:33 AM »
Hi,

 Also, did you actually named global variables the same as some local variables? This is a known issue that there will be clash in logic if an fsm tries to use a global variable named the same as one of its local variable. But it should not rename any variables...

 Bye,

 Jean

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Prefab reference to Global Variable - Playmaker ruined the project
« Reply #9 on: February 22, 2018, 05:40:35 AM »
Generally, avoid that kind of workflow if you don't want mess to occur. Instantiate objects which are populated with data and properties on runtime and work with local references and variavles as much as possible.
Available for Playmaker work