Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

Mount Points

Discussion in 'Assets and Asset Store' started by Tryz, Mar 22, 2014.

  1. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    1,063
    Thanks. As far as Playmaker, do you have a custom set of Actions?
     
  2. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,376
    There are some custom actions in the "Extras" folder.

    I built them with Playmaker a few years ago. So, they may need to be tweaked if Playmaker changed how actions are created.
     
  3. dmarot

    dmarot

    Joined:
    Jul 24, 2019
    Posts:
    5
    How do I implement the provided playmaker actions for Ootii Mount Points? When I try to use the Add Skinned Item action, I am only able to define the Mesh Resource Path as a variable instead of just being able to define the path itself. Same issue with connect mount points. If invoice # are needed please let me know as I've got pretty much every Ootii asset at this point. Thank you for any help you can provide
     
  4. resequenced

    resequenced

    Joined:
    Apr 17, 2014
    Posts:
    67
    I've been using Mount Points for about a year to manage customisation of my protagonist's clothes, hair, etc. It's been an excellent solution for this.

    The game is on Steam and has about 700 different items defined using Mount Points. I've just added another 81 items for a Halloween update, and Unity is presenting the following error on build:

    Serialized file size of 4.18 GB (4487047916 bytes) exceeds maximum. File name: 'I:/Unity/Resequenced/Temp/StagingArea/Data/resources.assets'. Serialized files over 4.00 GB (4294967295 bytes) cannot be loaded by the player. Some likely ways to reduce this are utilizing asset bundles, re-balancing asset locations, or limiting their serialized size e.g. limiting the maximum texture sizes.


    There's also a general thread about this issue: https://forum.unity.com/threads/bug-4gb-limit-to-textures-in-standalone-build.441116/

    So it appears I can't add any more items as /Resources has exceed 4GB. Has anyone else reported this limitation? Is there a workaround for MP?
     
  5. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,376
    Playmaker uses the variables. You need to add the path to Playmakers blackboard that holds variable values. That's just how Playmaker works.

    I haven't used Playmaker in a long time, but I'm assuming it still works this way.
     
  6. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,376
    Unfortunately, no work around for MP. Since I rely on Unity Resources, if that has this limit, I can't change that.
     
  7. resequenced

    resequenced

    Joined:
    Apr 17, 2014
    Posts:
    67
    No problem - thanks for confirming.
     
  8. chrisabranch

    chrisabranch

    Joined:
    Aug 15, 2014
    Posts:
    130
    If i make a daz character and want to add more clothes later will the work?
     
  9. SpyrosUn

    SpyrosUn

    Joined:
    Nov 20, 2016
    Posts:
    134
    EDIT : I have actually tried all sorts of things, and it looks that i can only see the axe if it's not parented to the right hand of the model. The moment I parent it there and select the mount list component on the editor, the axe just disappears. I have no clue why this happens, but i just can't get it to work properly.

    Notice that it works when i just add the axe manually on the hand of the player. This makes me think that this could be a bug.

    Hi ! I just purchased the mount points asset and for some reason when I am connecting an axe, it just disappears :O
    It's still on the scene but not visible. I have created a video to show the whole process. Any ideas why this is happening ? (haven't validated orientation yet, but it shouldn't disappear anyway, right ?)



    Also, for some reason the orange color graphics and icons do not show in the mount list and mount point components, not sure why that is, but i am not getting any console errors about it.
     
    Last edited: May 10, 2020
  10. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,376
    Hey @SpyrosUn , I got your email and I'm replying there. The video is great and I'm not sure what's up yet, but I'll help in email.
     
  11. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,184
    @Tryz , all, here's a question for you... what would you say is the best software to make occlusion (not ambient occlusion maps) for the purpose of blanking out covered skinned meshes in Mount Points?
     
  12. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,376
    Hey @Duffer123 , I just use Photoshop and add a layer on top of the skin texture. Then, I manually black out the parts that I don't want.

    I'm not sure if tools like Marvelous Designer do this automatically. I found the manual approach was easy enough and I've stuck with that.
     
    Duffer123 likes this.
  13. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    728
    I've finally found something I wanted to use Mount Points for in my project, but I have a question about scripting. Does Mount Points only accept strings when specifying parent and child points? The SampleUI script in Demos uses a command in the form:
    Code (CSharp):
    1. mMountPoints.ConnectMountPoints("Parent MP", GameObject, "Child MP");
    to connect 2 objects. I want to make a generic script ,and populate the mount points in the Inspector. I was able to replace the hard coded strings in the example with string variables, and my new code looks like this:
    Code (CSharp):
    1. public GameObject cGO; // child game object
    2. public string pMP= "parent mount point";
    3. public string cMP = "child mount point";
    4.  
    5. mMountPoints.ConnectMountPoints(pMP, cGO, cMP);
    It works, but I was wondering if there was a way to directly reference mount points, so they can be more easily dragged and dropped in the inspector instead. You have a MountPoint class defined, but I haven't been able to substitute it into the above script without generating a lot of errors. Is there a way to use it instead, and if so, how?

     
  14. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,376
    Hey @FargleBargle ,

    There is an object based function:
    Code (CSharp):
    1. public bool ConnectMountPoints(MountPoint rParentPoint, MountPoint rChildPoint)
    However, the "MountPoint" class isn't a Unity MonoBehavior. So, it's not something you can just drag-and-drop from the inspector.

    MountPoints is a MonoBehaviour that stores multiple "MountPoint" instances and the string name lets you get at a specific one.

    Mount is a MonoBehavior that stores a single "MountPoint". You can use the string name to get at the one, but not needed.


    MountPoints and and Mount are MonoBehaviours that wrap around the "MountPoint" (or multiple "MountPoint" instances) to give it some GUI functionality. So, you'd have to have code that uses the Mount or MountPoints to store and drag and then extract out the specific point you want to connect too. That's where all the string names come in.

    If you were using simple "Mount" MonoBehaviours to drag-and-drop them, the code to connect the mount points would be pretty easy it's something like this:
    Code (CSharp):
    1. Mount1.ConnectMountPoints(Mount2.Point);
    This is what I do in the Inspector code for dragging and dropping.
    MountEditor.cs (line 273) and MountPointsEditor.cs (line 938).

    I chose to have the actual MountPoint class not be a MonoBehaviour in order to cut down on all the bloat. They are much more efficient this way.
     
    FargleBargle likes this.
  15. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    728
    That's OK. After playing with it a bit more, strings aren't so bad to work with. I also discovered one big advantage: if I have multiple similar items, I can use the same string on each, making it easy to duplicate the trigger and use it on all of them, without changing anything. Serialized mount points would require that each one be unique, which would actually be more work. Thanks anyway for the explanation.
     
    Tryz likes this.
  16. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,184
    @Tryz ,

    Hi there - dumb question of the day... referring to your sample code in the manual:-

    Code Sample In the demo, I use a C# file named SampleUI.cs. In it, you’ll find several ways in which I connect objects through code. For ease, I’m listing key parts here so you can see how I’m using MP in code:

    mMountPoints.ConnectMountPoints("Right Hand", GameObject.Find("Sword"), "Mount Point");

    mMountPoints.DisconnectMountPoints(lSwordMP);

    mMountPoints.ConnectMountPoints("Left Arm", GameObject.Find("Shield"), "Mount Point");

    mMountPoints.ConnectMountPoints("Head", "Prefabs/Armor/Helmets/Helmet", "Head");

    mMountPoints.RemoveSkinnedItem("Hair");

    mMountPoints.AddSkinnedItem("Prefabs/Armor/Shirts/Shirt_02", "Prefabs/Armor/Shirts/Shirt_02_mask");

    mMountPoints.RemoveSkinnedItemFromPath("Prefabs/Armor/Shirts/Shirt_02");

    mMountPoints.AddSkinnedItem("Prefabs/Armor/Pants/Pants_02", "Prefabs/Armor/Pants/Pants_02_mask");

    mMountPoints.AddSkinnedItem("Prefabs/Armor/Shoes/Boots_02", "Prefabs/Armor/Shoes/Boots_02_mask");

    So... how do I add a skinned (item) mesh prefab specifically to the location 'Hair' if I've set that up as a location? - as opposed to simply Adding a Skinned (Mesh) Item...?
     
  17. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,376
    Hey @Duffer123 ,

    Because of how skinned meshes work, they attach differently.

    Static meshes (like a sword) don't care about bones. You just attach them to a transform (mount point) and they move and rotate with that parent.

    Skinned meshes don't attach to locations because the vertices of the mesh (skin) are weighted to specific bones during model creation. So, it doesn't really matter where you put the skinned mesh, it's going to follow the bones that it's weighted for. This is what allows a skinned mesh (like pants) animate with your character's skeleton.

    So, if your hair is a skinned mesh, it would be "skinned" to the head bone (and maybe neck bone or spine bones) of your skeleton. Skinned meshes typically get put at the root of the character and then follow the skeleton bones as they moves.

    I hope that helps,
    Tim
     
    Duffer123 likes this.
  18. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,184
    @Tryz ,

    Thanks for the prompt reply as ever. Sorry not sure I explained my question fully...

    Yeah I get that but I can see that your API allows you to remove any skinned mesh with the tag 'Hair' but doesn't (or does it?) allow you to add a skinned mesh (notwithstanding/irrespective which bone it is attached to/rigged) under the tag 'Hair' - or am I missing something?
     
  19. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,184
    @Tryz , sorry, in addition to question above, I was wondering about the (occlusion) masks... do they prevent only the body skinned mesh from poking through or any skinned mesh higher up in the mount list order?
     
  20. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,376
    Ah... I see.

    You're right.

    I'll add this function so that there is one:
    Code (CSharp):
    1.         /// <summary>
    2.         /// Instanciate a child GameObject and use the parent bones in order to drive this child's skinned mesh.
    3.         /// Since skinned meshes wrap specific bones, we don't need a parent bone to attach the child to.
    4.         /// </summary>
    5.         /// <param name="rItemPath">Path to the prefab we'll instanciate</param>
    6.         /// <param name="rMaskPath">Path to the mask texture used to hide part of the body</param>
    7.         /// <returns>MountItem containing the results of the instanciation</returns>
    8.         public SkinnedItem AddSkinnedItem(string rName, string rItemPath, string rMaskPath)
    9.         {
    10.             if (rItemPath == null || rItemPath.Length == 0) { return null; }
    11.             if (rMaskPath == null) { rMaskPath = ""; }
    12.  
    13.             SkinnedItem lItem = new SkinnedItem();
    14.             lItem._Name = rName;
    15.             lItem.ResourcePath = rItemPath;
    16.             lItem.MaskPath = rMaskPath;
    17.  
    18.             bool lCreated = AddSkinnedItem(lItem);
    19.             if (!lCreated) { return null; }
    20.  
    21.             return lItem;
    22.         }
    You can add that now (around line 636) or you could use the raw AddSkinnedItem(Item) function. You can see that in the function above, I actually use it as well.

    It only works on the "skin texture" that's on the body skinned mesh. I modify that texture in real-time based on all the active skinned meshes and masks.

    I didn't take it to that next level yet.
     
    Duffer123 likes this.
  21. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,184
    @Tryz , hah! Excellent as ever - thanks @Tryz !

    If you ever did take it to that next level, it might be best to make it optional and driven by the order in the mount list?
     
  22. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,184
    @Tryz , here's another thing I'm not sure about - what happens when the base character has more than one body (ie. body, head, arms, legs) material? Can you make that work with masking? (I have a workflow to combine in to one material and texture if not).
     
  23. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,376
    Right now it needs to be one texture.

    The work to support multiple body textures wouldn't be tough, but more about organization. Knowing that a "gloves" mask would apply to the hands body texture vs. the legs body texture for example. In my design, I just assumed the body texture would all be one. It may be time to evolve that.
     
    Duffer123 likes this.
  24. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,184
    @Tryz ,

    Understood. Is there no way with the current setup to direct different masks to different body 'part' materials? To jerry-rig it in some way?

    [edit]

    If not, yes please to the evolution of this asset (an optional in the inspector)! - it may be best to have a default body 'part' material and then have each add/remove 'named' (ie. hand, hair) equate with a selected body part 'material' if a checkbox says the masking is complex?

    [edit]

    Before I forget the thought, it also occurs to me that one piece of armour/clothing (ie. leather jacket) may require masks for say l arm, r arm, chest (or in my project's case, arms and body) ... so multiple masks to multiple body part materials with the one item of equipment/gear?
     
    Last edited: Dec 6, 2020
  25. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,376
    Not really. As you mention, multiple pieces of clothing could cross mask boundaries. So, we've got a kind of many-to-many relationship going on. That organization isn't impossible, but it does get more complex and performance will be impacted.

    First, we'd need a list of multiple skins... head, hands, torso, etc.

    Than, for each piece of clothing we'd need a list of masks each would have an index into the skins above. So, that shirt might have two mask (torso and arms). Each mask would reference the skin it modifies.

    Not horrible, but a lot more complex than my current: one-skin and each piece of clothing can modify any part on that one-skin.
     
    Duffer123 likes this.
  26. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,184
    @Tryz , any chance you could be persuaded to implement in next release (as optional) along with that other bit of code above?
     
  27. Tryz

    Tryz

    Joined:
    Apr 22, 2013
    Posts:
    3,376
    Unfortunately, it won't be for a couple of months. We're getting ready to open Super Nintendo World in Japan and it's crazy times. After Feb, I'll have some more time and will look at doing this. :)

    I'm just running out of hours in the day.
     
  28. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,184
    @Tryz , no worries - I can't blame you - 'Super Nintendo World' sounds really good fun!
     
  29. Zakrich

    Zakrich

    Joined:
    Sep 18, 2018
    Posts:
    3
    Hi @Tryz . I'm thinking about purchasing this for my project. I have a question though: does it work if a piece of clothing / accessory has extra animated bones?

    For example: I have a base character, and a pair of pants with a fake tail attached to it. I need the tail to be animated through cloth sim, so that if the character equip the pants, the tail will wiggle when the character walks around.

    Is this possible if I build the equipment system with Mount Points?
     
  30. LNMRae

    LNMRae

    Joined:
    Dec 28, 2012
    Posts:
    48
    I'm having an issue that I haven't had before with skinned meshes.

    I'm encountering a 'Resource not found. If you want to instantiate at run-time, please ensure the file is in a resource folder.' error. The thing that's odd about it is the error ONLY happens after I close and reopen my project. So long as I place my prefab into the resources folder I've created during that particular session, everything works as expected. It finds it just fine--then proceeds to be unable to find it again upon reopening the project.

    To make things even more strange, the issue only seems to be happening with prefabs, not the source fbx file. It never has any issues finding the fbx.

    Any ideas what could be going on?

    Still having this issue in a completely fresh project. I did notice another error popped up when I try to set the path:
    Code (CSharp):
    1. EndLayoutGroup: BeginLayoutGroup must be called first.
    2. UnityEditor.EditorGUILayout:EndVertical()
    3. MountPointsEditor:OnInspectorGUI() (at Assets/ootii/Editor/MountPoints/MountPointsEditor.cs:164)
    4. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
    5.  
    Edit: Welp, seems like this might have been a Unity bug. Continued investigation brought up the above error being an issue in a couple different versions. Updating to the latest 2020.3.5f1 LTS seems to have fixed it.
     
    Last edited: Apr 26, 2021
unityunity