Playmaker Forum

Bug Reporting => PlayMaker Bug Reporting => Topic started by: craigz on December 06, 2017, 04:04:01 PM

Title: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: craigz on December 06, 2017, 04:04:01 PM
Hi!

I keep having Global Variables deleting themselves and breaking their connections to FSM's. It's been getting super frustrating and I'm not sure what to do. Each time it happens I lose hours of work  :-\

Without really knowing how things are working, my only guess is that my Gameobject Global Variables section is corrupt somehow?

The variables that get disconnected don't show up in my Global Variables inspector preview OR the window. But they DO show up in the actual file If I crack it open.

Things to note:
1. First time this happened was with the 'game_game_manager' variable, which I now realize I have two of in my globals for some reason?

(https://i.imgur.com/K9azfdt.png)

2. The variable I'm currently missing is 'game_unit_manager' which shows up in the actual globals file still, but not in the globals inspector preview or the playmaker globals window.

(https://i.imgur.com/6gg88nq.png)

(https://i.imgur.com/tDDsRRu.png)

3. In the inspector preview of the globals, there's a floating/unassigned game object variable at the top, seems out of place, could possibly be contributing to the error?

(https://i.imgur.com/XjOMO5l.png)


I would just really appreciate some help with this. Been beyond frustrating ><

-craigz
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: craigz on December 06, 2017, 09:39:22 PM
Alrighty :) spent a day figuring this one out.

At some point within the past 3 or 4 versions of Playmaker I believe my global variables got corrupted. I specifically remember it happening around the time categories became a thing.

The issue was that when making a new global variable, it would delete one that was made prior, unlinking it from anything that was referencing it.

Here's what I did to fix it:

1. Open up your PlayMakerGlobals.asset file in mono.

2. Go to the variable header of the type of variable that was deleted. For instance, mine was a gameobject, so I scrolled to here ->

(https://i.imgur.com/Z6Jj7ph.png)

3. Go through line by line and see if you have any duplicate variables. It would look something like this ->

(https://i.imgur.com/K9azfdt.png)

4. Delete BOTH variables sections. I've highlighted what it should look like in red.

(https://i.imgur.com/Xa6OTcL.png)

5. Save the file. Exit out of the Global Variables window if you have that open. Then close Unity.

6. Open Unity again, open the PlayMakerGlobals.asset file again and do a ctrl+f to search for the variable to make sure it's not in there.

7. Open your globals variables window, create the variable again.

8. Go through your Error Check window and go ahead and put in that new variable you created.

***If your variables keep appearing in the PlayMakerGlobals asset file even after you delete them, delete them again, and delete all your categories from the file. Just scroll down til you find the area between Global Variables and Events. Or do a quick search ctrl+f for 'category'. Delete all the dashed categories and the category ID's (but be sure to leave a single dash under categories). Make it look like this ->

(https://i.imgur.com/PbCD61s.png)


After that, close Unity, open it back up and you should be all good to go!

I hope no one else has to put up with this problem. Cheers to a bug-free PlayMaker 2.0!

-craigz
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: jeanfabre on December 08, 2017, 02:09:40 AM
Hi,

 thanks for this. I pinged Alex on this, maybe there is something we can do internally to check for these duplicates and correct it. We'll see.

Bye,

 Jean
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: craigz on December 09, 2017, 09:25:02 PM
Excellent, great to hear Jean, thank you :)

Wish I had an exact version for when I think the problem originated for you guys, hopefully it was just a legacy issue for me. Saw a couple other people on the forum with it so just wanted to make sure the information was on the internet somewhere ;)
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: jeanfabre on December 14, 2017, 01:50:09 AM
Hi,

 yes, that's the spirit, thanks for contributing in the knowledge, it means a lot to us :)

 Bye,

 Jean
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: autumnboy on August 05, 2019, 01:11:41 AM
I had a problem where pasting values on top of an existing fsm via the inspector caused a global variable to take on the same name as another. This post helped me fix it and save a lot of hassle!

- I closed Unity.
- Opened the PlayMakerGlobals.asset file, fixed the name, saved it.
- Reopened Unity and it was fine.

Thanks,
Josh
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Wrensey on October 11, 2019, 12:05:29 AM
I just wanted to report in with saying that this still happens. The fix craigz posted seems to work for permanently deleting the corrupted variable, but it is still a massive pain to deal with.
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Numster on December 06, 2019, 07:16:20 AM
Hi !

Yep, this still happens... And I don't know how to open the .asset "in mono". Don't even understand what "in mono" is saying.
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: krmko on December 09, 2019, 03:41:16 PM
Just open it in any text editor.
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: zirai on April 24, 2020, 09:28:59 AM
Hi, still got this bug today. i use unity 2019.2.19f1
this happened after i copy paste fsm states (with global variable) into my prefabs.
Suddenly my i got duplicates global.

So i opened the global.asset and just rename one of the duplicates with _err

and i got bunch of zeros after variableCategoryIDs:  and delete it, restart unity
and delete the duplicate global with _err and it's problem solved.

one more thing, when this bug happened,i open and edit some of my prefabs and the global become corrupted. so yeah,don't do it :D
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: mmzbr on May 24, 2020, 01:42:33 PM
Using Unity 2018.4.17f1 and got this corrupted global variable bug.

One of mine Globals vanished from Resources.asset, had to re-create but Playmaker re-linked automatic all FSM.
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Christoph on November 12, 2020, 12:35:13 AM
Just happened to me with Unity 2019.4.8 and Playmaker 1.9.0. I was editing a prefab changing a 'Send Event' from GameObject FSM to just GameObject and the linked global variable (gameManager) just completely disappeared from my project.

I was able to go back to an older version of the project thanks to versioning. But wow, that's crazy that something like this even can happen!!!
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: djaydino on November 12, 2020, 05:11:06 AM
Hi.
It seems to happen when using undo while on a prefab with a global involved.

if it happens its best to restart unity, most of the times it seems to be back after doing that.

But more important, use Version control like github.
You can revert change on single files like the global
you can try something out and if it does not work you can just revert.

Also it backups only your changes so its way faster than making a backup of your project.
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Christoph on November 12, 2020, 11:50:44 AM
hmmm I'm using versioning but since playmaker works on a scene level it most of the time is just the scene that I commit. How can you get on a detailed level like revert only the global?
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Broken Stylus on November 12, 2020, 12:57:38 PM
hmmm I'm using versioning but since playmaker works on a scene level it most of the time is just the scene that I commit. How can you get on a detailed level like revert only the global?

The Globals are saved in a separate asset file in the Playmaker folder. Perhaps you should add this file to the versioning supervision too?
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Christoph on November 12, 2020, 01:25:40 PM
Yes, I just saw it appear now when adding a new global variable. Strangely enough, when that gameManager global variable broke, that change didn't get picked up by the versioning software (Sourcetree).

I will pay more attention next time it happens and report back. I'm too scared to experiment with the undo thing djaydino mentioned haha. I don't want to break anything for good. But I will also try not to use undo because it's true, I might have used the undo feature when it broke. So thanks for pointing this out too @djaydino
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Broken Stylus on November 13, 2020, 04:27:20 AM
Yes, Globals are very sensitive, it's always good to do some export or manual saving of the Globals file, just in case something bad happens.
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: djaydino on November 13, 2020, 09:18:44 AM
Hi.
Does your version control include the Playmaker folder?

as it should if its change andsaved.

but what i mostly have is that its gone and when restarting its back.
The change does not seem to save.

same as when i do changes on prefab variants, sometimes the changes are not working when i play the scene that has some prefabs of it.
Then when i restart they work

So i think its something that is not updated correctly in memory on playmaker during the session.
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Christoph on November 14, 2020, 10:02:05 AM
So I was working on a prefab yesterday (a menu item) and out of reflex I hit UNDO and I was like "fuck me". Seems nothing bad happened so I kept working since I haven't done any versioning for 5 hours because I literally was working on the same feature.

But guess what, my coin prefab once again broke and I just realized until another 5 hours later when I put the game on my device and out of accident played a level and picked a up coin.

Once again, for some reason, my gameManager became deactivated instead of the coin getting deactivated. I checked the coin and everything is setup correctly. So no idea how it can mix up these two.

I deleted the "activate gameobject" action inside the coin and added it again. Now it seems to work again. But I'm sure, the problem is in that Global Variables asset file that somehow got corrupted.

Playmaker should fix this bug. It's critical tbh and makes the entire asset feel super buggy out of nowhere. One might think that after so many years of its existence a bug like that shouldn't exist at all. In my humble opinion this even calls for a hotfix. It shouldn't exist any day longer.

And if it can't get fixed, why not block simply the UNDO shortcut while in prefab mode? Would that be doable?

Is there a way to get an official reply from support directly from Playmaker representative? I honestly would like to know what's their stand regarding this.
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Broken Stylus on November 15, 2020, 06:21:49 AM
What is your gameManager? It's an object I guess. Was it targeted, somehow, and stored in a Global variable?
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Christoph on November 15, 2020, 09:02:19 PM
Yes it's a gameobject that manages the game logic of the game like levels, coins, score, etc. And yes, it's stored as a global variable so it can be accessed from everywhere.

The coin does access it for example sending an event to the gameManager so it registers the coin pickup.
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Wrensey on November 25, 2020, 09:07:05 PM
Just happened to me in 2020.1, saw that a global variable was missing in the dropdown and was doing the duplicating thing in the global variables list. glad I came to this thread again because just closing and reopening unity again seemed to fix it which is nice.

Did give me the reminder to go ahead and connect my project to a GitHub repo

EDIT: nevermind its borked FML
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Broken Stylus on November 26, 2020, 09:53:02 AM
I encountered a problem similar to this when a global would suddenly be cloned and have two same entries. It's really f***d up things because the right one (the one without the mustache) was returning 0 in the "used by FSMs" count.
Deleting the evil clone solved this but it was hard to decide which one to erase.
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Christoph on November 26, 2020, 10:25:36 PM
It's crazy that there is no official reply from the Playmaker team about this.

I just came across another bug when working with prefabs. When you re-order actions within a state, the variables used get inverted.

(https://i.imgur.com/8TBWr0r.png)

For example in this setup. If I move the "De-Activate Game Object: Best Prize" action to the top and becomes the first action to execute, Playmaker will still use the variable from the previously first action (Chest Closed) in the first action and the setup for these two game objects becomes effectively reversed.

"De-Activate Game Object: Best Prize" will get Activated, while "Activate Game Object: Chest Closed" will get De-activated.

Working with Prefabs is a huge mess in Playmaker.
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: djaydino on November 27, 2020, 06:00:18 AM
Hi.
Yeah i have this as well, When changing/moving within (nested)prefabs
But usually when i restart unity after doing changes it is solved.

Also i tend to use variables instead of setting values directly.

There is also a update fsm and prefab preprocess in the playmaker menu that might help.

(https://i.imgur.com/xjFuhWK.png)
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Christoph on November 27, 2020, 01:40:35 PM
Interesting I didn't know about those settings so I googled them and came across this:

(https://i.imgur.com/wq4dpjW.png)

Source: https://hutonggames.fogbugz.com/default.asp?W311

But in the Asset Store this is not available. In Google it says that it was released 6 days ago...

Unfortunately I haven't found what Update, Load and Preprocess FSM/Builds exactly do. I read in this thread https://hutonggames.com/playmakerforum/index.php?topic=22169.0 that building time can become very slow due to prefabs, so I wondered if a lot of FSMs for example can slow down a project or the computer itself as well.

My iMac that has become extremely slow as of late. Actually the mouse (movement) is freezing suddenly and very often almost becoming impossible to work. Do you think this has to do with my Playmaker project? I do not have many prefabs yet in my project but I do already have a few FSMs.

Anyways, I will try to not use global variables at all anymore. At least completely avoid them in prefabs since they seem to be the main issue even with the moving/re-ordering actions. I still think this needs attention from the Playmaker team.

Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: djaydino on November 28, 2020, 01:12:27 AM
Hi.
Its Possible that v22 is not yet on the asset store.
When you update an asset unity has to review it 1st and that can take some time (usually 1-2 weeks)

Playmaker can not slow the computer itself.
Also prefab in your project should not slow things down.

But if you have many fsms on an object and have it selected it can slow down due to unity's refresh system.
Also fsm's with a large amount of states can slow down.

You can collapse the fsm's in the inspector to reduce the lag for that.
Also in preferences there are some options that you can set.

But i don't really have issues with mouse going slow/freeze.
What does happen is if writing text or selecting and dragging states / actions that it becomes laggy.

I am sure that Alex is looking into it, but i also think that it not that simple to fix.
Else it would have been fixed already :)
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Broken Stylus on November 28, 2020, 09:27:04 AM
My iMac that has become extremely slow as of late. Actually the mouse (movement) is freezing suddenly and very often almost becoming impossible to work. Do you think this has to do with my Playmaker project? I do not have many prefabs yet in my project but I do already have a few FSMs.

Could be bloatware or your hard drive disk dying. Also, it's Apple, each update conveniently becomes more power hungry but you are in need of the latest version of the OS to download an up to date XCode version.
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Christoph on December 01, 2020, 10:39:58 AM
Thanks guys for all the replies.

I'm currently looking with Alex and Jean into the problem. Is there an easy way to setup a demo scene that makes it easy to reproduce the problem?

Since I'm new to Unity/Playmaker I'm not sure how to go about that.

Regarding the computer being slow thanks for taking the Unity/Playmaker possibility out from the possible options list. I also checked my external peripherals and my disk, but haven't found the culprit yet. Will keep digging. :)
Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Gua on December 27, 2020, 01:33:50 PM
I also have this problem. I've just finished relinking some logic to new global variable, because one variable got replaced by another one in all fsms, but then I've spotted, that there's a new duplicate

(https://i.gyazo.com/95227a694e8fdf6bf805cdf50d760bb8.png)

All try some stuff from this topic to fix it.

Quote from: Christoph link=topic=16254.msg100851#msg100851
[img
https://i.imgur.com/wq4dpjW.png[/img]

Source: https://hutonggames.fogbugz.com/default.asp?W311

For me this page looks like this :(
(https://i.gyazo.com/8783b585da29fbed190772564087b2fa.png)

Title: Re: [SOLVED] Corrupt Global Variables - Disappearing/Unlinking
Post by: Broken Stylus on December 27, 2020, 05:03:51 PM
When I have sudden bugs with Globals, either with references suddenly being lost, a Global disappearing from the list or even, but very few times, the same var appearing twice, I know it's because a duplicate appeared inside the file.
Make a backup and delete the last var of the name that generates an issue, usually it's the "evil twin" that's lower in the list. At worse, a few references might need to be redefined manually in some FSMs because they might forget about the Global variable.
I wish the Global variables system were more stable too. Several extensions on the Asset Store make use of it so it should be made very reliable to users.