Forum rules - please read before posting.

Clothes missing after Loading

So I followed this tutorial : https://www.youtube.com/watch?v=14gQzeOL0Ec&t=5166shttp:// and somewhere around 1h:20m there is a part where Chris place the glasses on the player. I'm trying to use the same approach with my character.
When he wakes up he's only in PJs, but then I create an action to change the visibility of the PJs and make the other clothes visible and everything works perfectly. The problem comes when I load from a previous save where he had the clothes on, my player it's completely naked. I'm not sure what could be the problem. 
If any of you know what could cause this problem please let me know

Comments

  • edited April 2018
    Configuring the project to work with saving and loading is covered at the end of the tutorial - have you reached that point?
  • Oh... sorry my bad... I'll take a look. Thank you
  • Sorry to keep bothering you, but I hope you have an easy solution for my next bug related to more or less the same problem.
    Now I managed to get clothes saved when I load.
    The strange part is in the beginning of the game I make the player change his clothes from PJs to School Clothes, but when he gets back I'm doing the same thing as I was doing in the morning, but the strange part is that he changes the visibility only in the room where he changes the clothes. I'm not sure if I'm very explicit so I made a video so that you can see what I mean.

    https://www.youtube.com/watch?v=3tV7Si72brM&feature=youtu.be  

    Best regards
  • Make sure that "Retain in prefab?" is checked on all Remember / Constant ID components in the player's Inspector.  Otherwise, the values will change each time the player is spawned.  You may also have to re-assign the Action fields to the new ID numbers.

    However, since you're dealing with so many objects, it would be better to instead rely on animation to control what's shown/hidden - instead of manually affecting visibilities through Actions.

    Try instead making a new Animator layer uses different animations to control the enabled state of your various MeshRenderer components.  i.e. a "School" animation that shows the school clothes and not the PJs, and a "PJs" animation that shows the PJs and not the school clothes.

    You can then control the playback of the animation with a single Character: Animate Action, and save that animated state with a single Remember Animator component.
  • Thank you very much. I managed to do it with the Retain in prefab, I didn't understood exactly the other solution you proposed me. Maybe my English is not that good.
  • Hi there, this post is a bit old, but I'm quite near the release of the first episode of my game and while doing the testing I realized that my clothes aren't working as it should, so removed everything and started from scratch using this tutorial : https://www.youtube.com/watch?v=14gQzeOL0Ec&t=5694s

    This is my result and what I've found out. I got my character with different clothes, each piece of clothing, has the "Skinned Mesh Renderer" disabled. I created an ActionList for each type the player has to change the clothes.
    I did like in the tutorial, I drag and drop each piece of clothing on the action, like in the photo https://imgur.com/a/hdgqsBo.png

    Also I set the "Retain in prefab" on the "Constant Id" Component that was generated for the clothes and then hit apply. I did this for every type of clothes. (In my case I have 4 different situations: PJs, School Clothes, Home Clothes and Party Clothes).
    I just tested and it was working.
    I changed my clothes to "School" and left the room I was in, after that I got back inside changed the clothes to "Home" left the room and it was working.

    I had the correct clothes on me, however, I needed to do one more thing so that I could save/load, so I added the "Remember Visibility" and checked the "Retain in Prefab" for this Component to every piece of clothing and when I tried to see if it's still working it was not.
    This is what I've been doing :
    I started the game, I changed my clothes to "School" and then I went outside the room I was in, I saw my character dressed in the correct clothes, then I went back to the same room, I changed my clothes to "Home" and when I left the room I was seeing that I still got my "School" clothes on, but in the first room I had the correct clothes.
    I get the same result as in the video I posted above.
    Do you know what could be the problem and the solution. Also if you think that your solution
    "However, since you're dealing with so many objects, it would be better to instead rely on animation to control what's shown/hidden - instead of manually affecting visibilities through Actions." 
    could solve my problem, could you describe it a little bit in more details? Also if you know what could cause this problem, please let me know.

    Thank you.
  • I'll try to recreate the problem.  What are your AC and Unity version numbers?  Is the player object being spawned in from the Settings Manager in both scenes, or does either scene have the player object saved within the scene file itself?

    You should not need a separate Remember Visibility for each piece of clothing - just a single one on your top-level Renderer and check Affect children?.  If that option is checked on all of your individual RV components, then it may be creating a conflict.

    About the animation method, what I mean was that you create a new layer in your Animator reserved specifically for controlling what clothes are visible.  Give this layer a weight of 1, and create a new animation for each combination of clothes that the player can wear.  Then use an Integer parameter to control the transitions between them.

    This part isn't anything to do with AC - just using Unity's provided animation workflow: https://docs.unity3d.com/Manual/AnimationLayers.html

    What you can then do is use a single Character: Animate Action to control that Integer parameter's value whenever a change in clothes is needed.  To save, you can then just attach a single Remember Animator component onto the Player component.

    Of course, a third option would be to create a separate Player prefab for each clothes combination, and use the Player: Switch Action to change the active prefab whenever changing clothes.
  • edited May 2018
    Thank you for your fast response.
    My Unity version is: 2017 .3.1f1 Personal
    AC version : 1.60.4

    Yes, the player is spawned from the settings manager in both scenes

    About the using of a single element and check affect children. This was the way I was doing it before, I had a parent and I was just checking affect children, but I taught that maybe this was the problem, so I tried a different approach. 

    I'm gonna try doing the Animation method.
    If you have any luck on your side, please let me know.
  • Apologies, I was wrong about only needing a single Remember Visibility component.  The Affect children? option does not mean that it saves the individual visibility state of children - but instead gives each child the same state as the parent.

    If you use the visibility method, you'll need a separate such component on each MeshRenderer, with Retain in prefab? checked.

    However, that method causes no problems for me.  Changing the visibility, then switching scene, and back again, retains the visibility change.  I've tested in both v1.60.4 and the latest, but it might be worth you upgrading just in case (even if it's in a temporary test project).
  • Yes you were right. It's working in another project, however in my project it is not... I'm not sure what am I doing wrong, so I'm changing the clothes onStart for each scene based on a variable. It will be a quick fix for now.
    Thank you for your  time 
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.