Forum rules - please read before posting.
Tech questions during the weekend? Drop in on the community Discord channel!

Replace player clothing by switching complete prefab

I am using Fuse characters. Because of that I cannot simply reassign a new material to the player but actually need to swap the whole player as the clothing is contributing to the mesh and the new material would be displayed incorrectly.

Has anybody successfully done this yet?

I couldn't figure out a good way so far so my current working model is as follows:
  • Create a second player in edit mode that contains the new clothing
  • Copy all scripts to the second player
  • Make a prefab out of it
  • Add him as a new player in AC so that the switch command works
  • Execute the Player:Switch command during game play replacing the existing player at the exact postition
So far so good. Problem: the inventory is gone. Is there a way to transfer the complete inventory to the new player? Would be a great option to have that optionally in the switch action.

Comments

  • There is: if you've set Player switching to Allow in the Settings Manager, there'll be a Share same Inventory? checkbox immediately beneath it.
  • Will I be able to still have other playable characters that don't share the inventory? For the clothing change issue the player is visually still the same, only because Fuse characters don't support changing materials I use the switch player way. Later on in the game there will be really distinct players that should also have a different inventory to allow cool puzzles.
  • No - if you want to be able to switch freely between those other players, you'd be better off unchecking that box, and instead using parameterised ActionList assets whenever you want to add/remove an item shared by your two costume-switching Player prefabs.  You should be able to make an ActionList that e.g. adds the same parameterised inventory item to both Player prefabs, so that you can use an ActionList: Run Action instead of multiple Inventory: Add or remove Actions.
  • Hi Chris, I found an easier way that I propose to add to the switch action. I added a "keepInventory" boolean to the resertPlayer method and added a flag to the switch player action. I think that is quite handy and has more use-cases than just the one I outlined. Would be great to see that included :-)

    I will send you the diff via PM.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.