Search Unity

UMA - Unity Multipurpose Avatar on the Asset Store!

Discussion in 'Assets and Asset Store' started by FernandoRibeiro, Dec 24, 2013.

  1. Creiz

    Creiz

    Joined:
    Jun 6, 2017
    Posts:
    130
    Quick question, how do we get the name of a wardrobe recipe in a slot? I am trying to clear let's say some pants, I know how to clear it, but I can't figure out how the get the name of the recipe that was on that slot.
     
  2. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Debug.Log("The slot name is "+ MyAvatar.WardrobeRecipes[SlotName].name);
     
  3. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    Hi, thanks for the quick response, yes, the artist is exporting from blender 2.8, I guess the problem resides in the bones Z+ might be not be totally aligned to the "LookAt" to the children bone? meaning something like this:
    img.jpg
    Where the hierarchy of bones would be A is parent of B, thus unity's magic is correcting this, but the raw data is not corrected (I had this kind of issues in the past working with the Kinect asset, I'm not sure if this is the case but it's something that comes to my mind).

    if this is the case, how should the transforms be aligned and rolled? thanks
     
  4. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Cut and paste from the updated docs for Blender 2.8/UMA:

    Exporting from Blender 2.8 requires you to go to the fbx options, Armature setting, and change the Primary Bone Axis to “X Axis” and the Secondary Bone Axis to “-Y Axis”. The asset will usually need to be scaled 100x in the import settings in Unity.

    It´s very important when exporting content being sure both it´s position, rotation and scale are normalized, this means you need to bake all those into vertices position. This can be made with “Ctrl+A” or “Object/Apply”.​

    That basically means you need to select your mesh, and apply the location, scale and rotation.
     
    Deleted User and Cleverlie like this.
  5. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    thanks I will forward this info to the artist and try to get something working
     
  6. chaza_li

    chaza_li

    Joined:
    Jan 8, 2018
    Posts:
    29
    Hey team, sorry for bothering again, just another quick question

    Is it possible for UMA to create some slots linked to 3D models that are placed in the StreamingAssets folder, and being able to synchronize to the change of 3D models after the game is being built?

    For example, creating 10 preset heads in the game and modders may override the preset heads with their correctly rigged and painted head models.
     
  7. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    Hi Jaimi, we followed these instructions, even tried combinations of different export settings, including activating/deactivating the "Apply Transforms !Experimental" option, different primary/secondary axis, etc.

    even opening the .blend file provided by secret anorak here: https://github.com/umasteeringgroup/content-pack/tree/master/ContentPack_2.7.0.0/Blender

    in blender 2.8, then exporting the FBX with the export options recommended in the documentation, when imported into UMA in unity 2018.3.6 (creating a new race out of it) gives us this
    ppp.jpg

    the mesh is not visible because I just created a slot with the first submesh (which is the teeth) for quick debug, but you can already see that the arms are upwards and there are some weird rotations of the legs, this is with the official Human Male .blend file, opened in blender 2.8 and exported to fbx again.

    Also, I'm a user of Cinema4D, I opened the fbx file provided by the artist (which is exported from blender2.8), I applied a setting in cinema4D that "aligns" joints, it doesnt explain too much what it does, but it seems to align all joints of the rig to be Z+ their forward.
    ddd.jpg

    after this, I exported the fbx from Cinema4D and it worked like charm in UMA.

    Yet, the problem is, I can't work like this, since there is a lot of other stuff involved in the workflow, lots of animations, blendshapes, etc.

    the artists are senior Blender users, they have like 10+ years of experience with Unity, and I'm a senior Unity user, yet we still can't figure out what the heck is going on, we only can make some educated guesses because the docs don't explain too much and this seems to be a blind try and error thing.

    So I will not be able to use Cinema4D to fix things that blender seem to break, but this gave me some insights.

    I guess the real question here is, why is it so hard to make a model work in UMA? when UMA is supposed to work with any model, rig, even non humanoids, as stated many times, even SecretAnorak says that you can do a UMA out of anything, an airplane, a horse, then why UMA is so dependant of how you made your rigs, there has to be a better UX than going back and forth just blindly experimenting with different export options, arrangements of stuff, features of different software etc, just to be in the same place where you started, the documentation seems very vague about what exactly gets broken in the blender fbx exporter, even using the official HumanMale model in blender and exporting it seems to completely break it, so I wonder if the problem resides in blender, in the export settings, or in the blender version, or Unity version, or UMA, or what not, there are so many variables :(.
    Shouldn't UMA do the same magic Unity does at the time of importing the model rig? it shouldn't be that hard to import a rig, I feel like I'm missing some very silly stupid thing that make it all work.

    I hope that if there is any user that had to deal with these same problems they can read this and give us some insights, otherwise my bosses will decide to ditch UMA completely and go with another alternative, which I don't want since UMA is a great solution for what we need, its just this fbx import problems that got us stuck. please help! and thanks in advance.
     
    Last edited: Mar 7, 2019
  8. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    UMA right now requires that the skeleton to be correctly normalized. We simply don't have access to the source code of Unity to be able to duplicate how it does things.
    You should tell your artists that the skeleton needs to be normalized. That means each bone should be the correct position and size, but it's location should be 0,0,0 it's rotation should be 0,0,0 and it's scale should be 1,1,1. This is not just a UMA thing, it's a best practice.

    What you can do to fix a bad rig in Blender is to select the rig, go into pose mode, select all bones ("A"), and then select "Pose/Apply/Apply Visual Transform to Pose".

    Be sure to export your TPose again.

     
    Last edited: Mar 7, 2019
    TeagansDad and Cleverlie like this.
  9. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    UMA 2.8.1 RC 1 Released

    https://github.com/umasteeringgroup/UMA/releases/tag/v2.8,1rc1
    • Restructed files and folders.
    • Easier to delete examples.
    • Added ASMDEF files to speed compiles. (This is a 2017.3+ feature)
    • Various minor fixes and updates (new accessors, build issues fixed, etc).
    • Added DCA Randomizer and Random Crowd generator and scene.
    • Updated General Documentation.
    • Added Content Creation documentation.

    Upgrading from 2.8:

    You should remove the previous UMA folder before importing! Save all your custom content somewhere, and delete the UMA folder. Many files have changed location.

    Upgrading from 2.7 or a previous version

    With the change in type, your global library will need to be rebuilt.
    You can update the old DNAConverterBehaviour prefabs to the new DNAConverterControllers by selecting the warning in the console and following the text directions.
    HumanMale and HumanFemale are now using Bone Poses for initial bone morphs. This can cause some slight differences in characters having DNA applied. If you need the old behavior, you should change your race to the "Legacy" version of the races.
    Note: Blendshapes do not work correctly on 2018.3 when GPU skinning is enabled. Please disable GPU skinning in your 2018.3 project until Unity has addressed this bug.
     
    TeagansDad, hopeful and kenamis like this.
  10. ecurtz

    ecurtz

    Joined:
    May 13, 2009
    Posts:
    640
    The root of the issue is Unity's lazy method of importing models. Rather than correct any of the issues with the mesh data they just import things like scaling and rotation into the transforms. I've been working on a new mesh combiner for UMA 3 which does bone transfer, so we might be able to leverage that and fix the mesh data when we create the slots in the future, but in general the rule is to completely "apply" any changes to the model before export so the mesh data isn't relying on the state of the skeleton / import settings. Are you still having issues when you're doing that?
     
  11. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    thanks for the responses, I told the artists to do that, to apply transforms to everything, and all scales should be 1,1,1

    I'm not sure what you mean by "it's location should be 0,0,0 it's rotation should be 0,0,0" because you need rotations and positions different than zero, otherwise all bones would be located at the world origin, but I'm sure I'm missing the point, I'll double check again later with the artists that everyrthing is normalized, they already told me that everything is already normalized, but I'll check again.

    also, shouldnt the "Apply Transforms !EXPERIMENTAL" option in the fbx exporter do exactly what you ask? meaning it applies any transformation to the real bone transforms. Anyways I'm very confused, I'm not a blender user and it differs a lot with Cinema4D so I can't be sure we all talk in the same language here haha, thanks again for the answers.
     
  12. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    btw, I already think this has to do with something else other than the normalization of transforms, since as I stated before, we imported the .blend file of the HumanMale into blender, then exported the fbx with the settings discussed, and it didn't work well with UMA, meaning that even the official rig is getting broken after we put it in and out of blender 2.8, something smells to me that blender is doing something wrong at exporting
     
  13. Admin_Friend_Factory

    Admin_Friend_Factory

    Joined:
    Oct 23, 2018
    Posts:
    41
    Thanks, when you created a prefab in 2017.4, was it a clean prefab without the UMA components?
     
  14. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I haven't the slightest idea what "Apply Transforms !EXPERIMENTAL" does. What it does not do is normalize the skeleton.

    And no, the bones won't be at the origin if their locations are 0,0,0. These are the transforms, not the actual positions.

    Do this: Open the default skeleton for the UMA from the content pack here:

    https://github.com/umasteeringgroup/content-pack/tree/master/ContentPack_2.7.0.0/Blender

    Now select the rig, and go into pose mode.

    Click on any bone. Look at the transform - it should be location 0,0,0 rotation 0,0,0 scale 1,1,1

    You can see the transform on the view panel inside the left part of the 3D view:

    transforms.jpg

    To clean your rig so it looks like this, they just can't "apply" the skeleton, they need to select all the bones in pose mode, and choose the option to apply the visual transform - baking the transform into the object:

    ApplyVisualTransform.jpg
     
    Last edited: Mar 8, 2019
    TeagansDad, hopeful and Cleverlie like this.
  15. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I will try again with the official rig, but I tried it earlier this week and didn't have any issues. Of course, with beta software stuff breaks quite often.
     
    Cleverlie likes this.
  16. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Yes - worked like a charm. I believe its blowing up in 2018.3 and not cleaning up the components.
     
  17. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    roger, will check that out with the artist and give some feedback here.

    btw sorry for the confusion, once we figure this out I'll make a tutorial for the next newcomers to maybe add to the forums or content creation docs, and avoid any more frustrations :)

    I really like what you are building here with UMA and I'll be glad to contribute in any way once I figure out the basics
     
  18. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Great - all help is welcome, especially documentation. :)

    I tested the default rig - I pulled it up, and setup the parameters as shown in the docs, and exported the new jacket I am converting/working on, and the slot built correctly:

    NewJacket.jpg

    These are the parameters that I used when exporting the FBX:

    fbx1.jpg
    fbx2.jpg
    fbx3.jpg
    fbx4.jpg
     
    Last edited: Mar 8, 2019
  19. cwmanley

    cwmanley

    Joined:
    Aug 8, 2013
    Posts:
    205
    Hi,

    This should be possible you would direct your url to the streaming assets folder. I can't remember much beyond changing the url to the GetStreamingAssetFolder(), but I had a very basic setup similar to a modders folder working before.
     
  20. chaza_li

    chaza_li

    Joined:
    Jan 8, 2018
    Posts:
    29
    Thank you so much cwmanley! This answer definitely saved me loads of time! Hope you have a nice day
     
    cwmanley likes this.
  21. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    Hi guys, I'm starting to think there is a bug with UMA 2.8 (from the asset store) and unity 2018.3.6f1

    I dowloaded a fresh copy of blender 2.8 beta (the latest from the website)
    then dowloaded the .blend file from secretAnorak content pack (this one: https://github.com/umasteeringgroup/content-pack/blob/master/ContentPack_2.7.0.0/Blender/UMA Blender Male Unified.blend)

    then exported the fbx from blender, exactly as it is, with the export settings Jaimi provided me

    then I imported the fbx into Unity 2018.3.6, followed exactly the same steps SecretAnorak does in his tutorials to create a new race, I set the fbx to humanoid rig, opened the avatar configuration scene, Enforce T-Pose, apply, UMA-> extract T-Pose (here is where I think UMA is messing something up) then Done.

    then I set up the Race and TextRecipe files, I create Slots with the slot builder, setup the race with these slots, then go to my UMADynamicCharacterAvatar, and set the race to my custom race.

    when I hit play:

    test.jpg

    (btw ignore the texture, is because I'm using an overlay from another character with another UVS)

    I don't know what else to do, the artist are sure that everything is normalized and zeroed, the visual transform is applied from the beginning, the export settings are followed carefully as Jaimi said, I'm going to test this with unity 2018.2 just in case, but we are hopeless at this point, spent 3 days trying to make even the default uma male work, my best guess is that unity 2018.3.6 is breaking the "extract t-pose" functionality in the UMA 2.8 version uploaded to the asset store.

    EDIT: just tested a fresh new unity project with 2018.2.20f1, fresh new download of UMA from the asset store, and same results :(, the HumanMale is still broken.
     
    Last edited: Mar 8, 2019
  22. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I have duplicated the issue - The mesh is fine, but the skeleton is borked.
    The simplest thing to do (until we figure out exactly what to do) is to import your model+rig into 2.79c, and export the fbx from there, and use that FBX to build the TPose. The elf-ears that I created exported the bones correctly. not sure why the arms/legs are wrong. Maybe something simple, maybe not.
     
  23. DankP3

    DankP3

    Joined:
    Jul 17, 2017
    Posts:
    93
    What about dragging the blend file into unity and letting unity import? Fbx export is imperfect in blender 2.79 too.
     
  24. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    @Cleverlie
    @Jaimi
    I've seen (and fixed) that issue many times for several people. It's an issue in the Unity Avatar configuration. Either it didn't map the uma bones to the correct human bones or there's an extra or missing rotation on the global or position bones. Double check the mapped bones are correct (the auto mapper fails sometimes) and if you still have the issue then send me your race files to me in PM and I'll fix it.
     
    TeagansDad and hopeful like this.
  25. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    Hi guys, I just made a video following all the steps to reproduce the bug



    I can give you a blend file with the rig, I'm not sure I'm allowed to give you the models, but I will appreciate any help!

    EDIT: I also tried with Blender 2.79, same results.

    the human bones config can be seen in the video in the moment I enter the configure mode, seems to me that everything is correctly assigned, so I don't know...

    for the record this happens with UMA 2.8 from asset store, in bot Unity 2018.3.6 and 2018.2.20, and with blender 2.79 and 2.8 latest beta.
     
    Last edited: Mar 8, 2019
  26. kenamis

    kenamis

    Joined:
    Feb 5, 2015
    Posts:
    387
    Please stop jumping to conclusions

    The model and uma assets in your video? The public/freely available MIT licensed one... I don't want the blend file. I haven't used blender much.

    From the 180 rotation in the avatar config, it sounds like you need your forward export to be -Z forward, not Z forward, but I don't use blender much so maybe @Jaimi has a suggestion.
     
  27. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    We were able to fix the issues in the blend, and get correct results for the TPose with the posted parameters above. To do this, I had to remove the 180 degree Z rotation from the rig itself "UMA_Male_Rig".

    This does not mean that everything is correct yet. I still need to test slot building meshes and additional bones.
     
    TeagansDad and hopeful like this.
  28. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Further testing is showing that this is correct - I've added new slots, with new bones, and added the new Tpose. And they all work together nicely with the old slots.

    I'll update the blender content for Blender 2.8 this week.
     
    hopeful and Cleverlie like this.
  29. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    sorry I'm not giving final conclusions, only hypothesis or educated guesses, I'm just clueless here, because I spent 3 days with my team trying to get this done, tried too many variations and combinations of settings, software versions, models, even the official ones, and still can't get something working, so I'm just calling it a bug or incompatibility or whatever it is, not to blame anyone, just to inform the facts, thats why I spent some time making that video so the UMA devs can have a better view of what's going on, I'm just doing my best to get to the core of the problem and give the community the best info to reproduce the problem.

    the only thing that I can have a conclusion is that there seems not to be a deterministic formula to follow to properly prepare your models for UMA, at least in blender, it's trial and error thing and without a precise guide like "all your bones must have their roll at zero degrees, their forward to Z, the Global bone must be at world's zero, facing world's Z+, and their up must be at Y-, and there can't be bla bla, etc" all I have left is to ask for help, I didn't want to sound rude if that was the case, althought I might sound anxious because I had until today to fix this, otherwise my bosses are ditching UMA as the framework to use in our project, and I wanted to use it because I love it.
     
  30. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    thanks Jaimi, is there a reason why removing or adding the 180 degree to the Z rotation worked? what I mean is there some rules or guidelines on what should or shouldn't happen with our bones so we can generalize the solution for other rigs? thanks again
     
  31. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Blender uses a different handedness than Unity (ie, Z is up, etc). So things are rotated and backwards in some cases.
    Unity does a fantastic job of hiding this in the background, but when you access the raw data, you need to know about it. The old Blender FBX exporter did not allow you to specify the primary and secondary axis for the armature, so this required several workarounds.

    The rule when using the new exporter is that it doesn't require that goofy workaround anymore - when looking at the "front" view, you really should see the front of the model/rig in Blender. Of course all the rest of the stuff we said above (normalizing) is still correct.

    If you do have issues with your blend after adjusting the rig, let me know and we can take a look at the blend file.
     
    Cleverlie and hopeful like this.
  32. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,682
    Just so you know, and can tell your bosses, UMA has been stable for quite some time. If I have it right, it sounds like this new bug is minor, and it comes from changes recently made in the Blender - Unity connection. UMA has had to use the Z-axis offsetting from the very beginning (back in 2013), so this is an odd change to have happen.

    Thanks for finding it and reporting it! And of course much thanks to @Jaimi and @kenamis for getting to the bottom of it and figuring it out. :)
     
  33. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    870
    Last edited: Mar 9, 2019
  34. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    I don't have any familiarity with it, but if it produces an FBX, you should be able to take it into a 3D Modelling app and rig it to the UMA skeleton. Or, you could even just mount the head & neck to the appropriate bones in the scene, but that would be less than ideal. Or you could take the face texture, and generate an overlay from it that would replace the face on the UMA. Several things you could do, but none are particularly quick and easy.
     
    Last edited: Mar 9, 2019
  35. nsmith1024

    nsmith1024

    Joined:
    Mar 18, 2014
    Posts:
    870
    Maybe you could work with the creator of that face generating avatar, seems hes working on integrating it with UMA, here is his post (scroll to near the end), it would make UMA 10 times awesome!

    https://forum.unity.com/threads/released-avatar-maker-3d-avatar-from-a-single-selfie.600724/
     
  36. Cleverlie

    Cleverlie

    Joined:
    Dec 23, 2013
    Posts:
    219
    I'll keep trying once in a while in my free time, maybe next monday I can give you a copy of the blend file we are using (I'll ask the artist to give me a clean file with the rig and some basic mesh skinned since I can't share the original custom meshes cause copyright issues), and maybe you realize one of those "eureka" moments where you tell me "you had X bone wrong all along" or something like that, we will figure this out!

    yeah I think the same, this is probably a minor thing since stuff is recently updated to latest software versions, maybe once I figure this out in my free time I can get back to them and convince them to give me a second try :)
     
  37. twospoonstn

    twospoonstn

    Joined:
    Mar 10, 2013
    Posts:
    12
    Is HDRP / LWRP part of UMA 2.8.1 RC 1?
     
  38. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    No. That is still an experimental branch, likely will not come until the next point release.
     
  39. drakedane

    drakedane

    Joined:
    May 23, 2017
    Posts:
    62
    Just finished a series of upgrades: from Unity 2017 to the latest Unity 2018 & from UMA 2.5 to UMA 2.8.

    After encountering MANY issues and spending much of the day on this, I am almost back to normal. The only thing still missing is that DNA saved in old files is not being restored, when I tried to load. For some reason, other data seems to load from these files (like wardrobe info).

    When I tweaked DNA and saved new UMA characters, DNA saved/restored as it always has, in the past; which made me decide to compare the new text file I saved against the older UMA character save files. And the data format definitely seems to be changed, in several ways, in terms of DNA; while the wardrobe data seemed to be the same. So starting to think that this is the problem: new version of UMA no longer works with my old save files?

    But, if so, how do I fix this?? Is there a converter? Or do I have to now manually reset DNA sliders for all of my UMA characters?? That will NOT be fun, especially after spending all day just trying to get back to normal! Any help would be appreciated! UMA DNA sliders go from 0 - 1; but clearly values in save file are not "between 0 & 1". So I seems like I can't even use these old files as references, while resetting DNA sliders, so really hope there is some way to convert these files!
     
  40. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    This might be because the DNA Converters changed on the race. The old converters are still there - you might try swapping out the converters to the ones that are on the Legacy races.
     
    drakedane likes this.
  41. drakedane

    drakedane

    Joined:
    May 23, 2017
    Posts:
    62
    Thanks, Jaimi. Can you point me to instructions about how to do that? How do I swap out the converters? Will this update the old UMA save files to new data format, or will this just allow UMA to load data from the these old text files?? Latest version of UMA definitely seems to save the DNA data differently than earlier versions. So just curious about how this might work.

    Thanks for quick turnaround, btw. Taking a break from the project for a few. So will check in later!
     
  42. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    Browse for racedata objects by typing T:RaceData in the project filter.
    The "Human Male Legacy" and "Human Female Legacy" races use the old converters - You will see them under "DNA Converter List" section. those are the ones you want. Make a note of their names.

    Find the race you are using, and remove the converter(s) that are on it (click the x).
    Then add the converters for the appropriate race (male legacy or female legacy).

    If that doesn't work, then I'm at a loss - probably need to get on Slack and ask dos - he's the one who made the (extremely cool) new converters.
     
    hopeful likes this.
  43. drakedane

    drakedane

    Joined:
    May 23, 2017
    Posts:
    62
    Thanks so much! Will give it a try!
     
  44. Myst12

    Myst12

    Joined:
    Mar 6, 2019
    Posts:
    7
    HI its me again and I am currently trying to create a color picker from pictures for my UMA's hair, skin and eyes. But I have run into the issue of it not actually picking the color from the image at all even though I have my codes placed properly.

    this is the code I was using from a tutorial to get the basics of getting the color for the skin

    public void ChangeSkinColor(Color col)
    {
    avatar.SetColor("Skin", col);
    avatar.UpdateColors(true);
    }

    and I have the color picking code here

    using System;
    using UnityEngine;
    using UnityEngine.UI;
    using UnityEngine.Events;
    using UnityEngine.EventSystems;
    public class ImageColorPicker : MonoBehaviour
    {
    public Color SelectedColor;
    [Serializable]
    public class ColorEvent : UnityEvent<Color> { }
    public ColorEvent OnColorPicked = new ColorEvent();
    public void OnPointerClick(PointerEventData eventData)
    {
    SelectedColor = GetColor(GetPointerUVPosition());
    OnColorPicked.Invoke(SelectedColor);
    }
    private Color GetColor(Vector2 pos)
    {
    Texture2D texture = GetComponent<Image>().sprite.texture;
    Color selected = texture.GetPixelBilinear(pos.x, pos.y);
    selected.a = 1;
    return selected;
    }

    I added this image color picker code to my sprite and placed the sprite onto an image. I enabled the read and write box and added the on click event. My character being the object of change and the change skin color being the thing I wanted to change. Yet when I hit play nothing happens am I missing something or is there a simpler way of doing things?
     
    Last edited: Mar 10, 2019
  45. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    First:

    BuildCharacter works in your ChangeSkinColor code. But it's heavy. if you're only changing the color, you can just call Avatar.UpdateColors(true);

    Second, is you ChangeSkinColor being called? I think the problem is probably the OnPointerClick is not being called.

     
    Last edited: Mar 10, 2019
    Myst12 likes this.
  46. Myst12

    Myst12

    Joined:
    Mar 6, 2019
    Posts:
    7
    OK thanks so much for that ill go back and fix that.
     
  47. Myst12

    Myst12

    Joined:
    Mar 6, 2019
    Posts:
    7
    So I went back and fixed the text and re-hooked up the character and the ChangeSkinColor it looks like this

    Capture.PNG

    and If this is what you meant by calling then when I played the game the skin never changed its color when picking it. Sorry if i don't get it i'm still new to this.
     
  48. Myst12

    Myst12

    Joined:
    Mar 6, 2019
    Posts:
    7
    OMG!!!! i AM SO sorry for bothering you lol just solved my problem. When looking at my color picking code I realized that this:

    public class ImageColorPicker : MonoBehaviour

    should have been this:

    public class ImageColorPicker : MonoBehaviour, IPointerClickHandler
     
    hopeful likes this.
  49. shadowlord1

    shadowlord1

    Joined:
    Aug 15, 2014
    Posts:
    32
    Guys, what's the current way for saving UMA avatar?
    I've an UMA DCS in the scene... I'd like to get the string, so I can save it on the database....
    How do I get the string of the avatar?
     
  50. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    This is in the documentation:

     
    hopeful likes this.