playMaker

Author Topic: Prefab randomly changes its target and variables  (Read 1218 times)

Hasuman

  • Playmaker Newbie
  • *
  • Posts: 19
Prefab randomly changes its target and variables
« on: September 03, 2020, 08:55:08 AM »
Hi, I've run into a really weird and frustrating problem that I can't understand at all.

My player character has a model and a "hurtbox" (a trigger for attacks) both connected to a controller object. After working an entire year on the game, the controller object's FSM suddenly has started to switch variables and objects for no apparent reason. Two global variables pointing at the model and hurtbox, "PlayerModel" and "PlayerHurtboxMelee" switched positions, so all commands for player's animations and such are now sent to the hurtbox, and all hurtbox commands are going to the player model.

Today I decided to get rid of those global variables by simply pointing directly to the objects instead of variables, but lo and behold, now it actually switched the targeted player model and hurtbox objects too. Not just the names of the variables, but the objects themselves. I always manage to manually fix this error, but it keeps coming back.

I haven't changed the hierarchy or done anything drastic to the game so I can't pinpoint the reason for a bug like this. Just basic combat mechanics where the floats and bools change on the hurtbox and animations play on the character model.

Unfortunately I can't share the game since it's a huge project at this point. I'm really desperate. If this can't be fixed I might have to redo everything and even then hope that this won't repeat.

Playmaker version: 1.9.0
Unity version: 2019.2.8f1

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Prefab randomly changes its target and variables
« Reply #1 on: September 03, 2020, 09:06:53 AM »
Hi.
Something you can try is to replace the state,
Make a new state and move the actions that do not need to be changed and the action that has to be changed you can try to move or place a new action.

Also after doing changes in a prefab restarting unity can be helpfull

Are you using nested prefabs?

I sometimes get similar issues but mostly when using nested prefabs

Hasuman

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Prefab randomly changes its target and variables
« Reply #2 on: September 03, 2020, 09:11:13 AM »
What do nested prefabs mean? Prefabs inside of prefabs? In that case the only prefab I'm using is the player's model inside of the actual player controller.

As for moving the actions, let me clarify what you're saying. You mean I should seperate the working actions, and the actions with the bug, to their own states?

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Prefab randomly changes its target and variables
« Reply #3 on: September 03, 2020, 09:15:34 AM »
Hi.
I mean prefab variants

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Prefab randomly changes its target and variables
« Reply #4 on: September 03, 2020, 09:18:22 AM »
Hi.
No.
Make 1 state and move the action from the old state in the created state and then replace the old state with the new state (remove the old state and connect transition to the new one)

Hasuman

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Prefab randomly changes its target and variables
« Reply #5 on: September 03, 2020, 09:27:38 AM »
Okay, I'll try that today! You mentioned having similar problems in the past. Have you had this happen on multiple FSM's at the same time? Because this bug has affected all four FSM's on the controller object.
« Last Edit: September 03, 2020, 09:54:10 AM by Hasuman »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Prefab randomly changes its target and variables
« Reply #6 on: September 04, 2020, 10:30:34 AM »
Hi.
Yes especially with variants.

Currently if i do changes to a prefab that is used in scenes directly or in variants i restart unity after the changes

Hasuman

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Prefab randomly changes its target and variables
« Reply #7 on: September 04, 2020, 01:08:58 PM »
Well, after trying to fix it, and almost succeeding in it, the entire prefab got corrupted. But that most likely wasn't the case with Playmaker. Basically my keyboard's cord finally broke for good, causing the external HDD which I was currently reading my project from to disconnect. Unity froze and the prefab was corrupted after reloading the project. Time to revert and fix this problem before it even manages to return.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Prefab randomly changes its target and variables
« Reply #8 on: September 04, 2020, 03:10:54 PM »
Hi.
What are you using for version control?