Search Unity

UMA Power Tools Support (v. 2.9)

Discussion in 'Assets and Asset Store' started by UnLogick, Jan 7, 2014.

  1. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Please explain how you instantiate the new prefabs the game scene. Try adding Debug.Log statements and finally try looking at the log file for clues to why it failed to work. Please post the results of your investigations so I can help you.

    I wrote some simple code which spawns 400 characters from a prefab:
    http://glscene.com/unity/Hugo400/Hugo400.html

    I used the following instantiate code for that project
    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class SpawnScript : MonoBehaviour
    6. {
    7.     public GameObject[] prefabs;
    8.     public int index;
    9.     public int dimensions = 20;
    10.     private int loaded = -1;
    11.     private bool processing = false;
    12.     // Use this for initialization
    13.     void Start () {
    14.     }
    15.    
    16.     // Update is called once per frame
    17.     void Update () {
    18.         if (Input.GetKeyDown(KeyCode.Space))
    19.         {
    20.             index = (index + 1) % prefabs.Length;
    21.         }
    22.         if (Input.GetKeyDown(KeyCode.Minus))
    23.         {
    24.             if (dimensions == 1) return;
    25.             dimensions /= 2;
    26.             loaded = prefabs.Length;
    27.         }
    28.         if (Input.GetKeyDown(KeyCode.Plus))
    29.         {
    30.             dimensions *= 2;
    31.             loaded = prefabs.Length;
    32.         }
    33.         if (index != loaded  !processing)
    34.         {
    35.             processing = true;
    36.             StartCoroutine(Process(prefabs[index], dimensions));
    37.         }    
    38.     }
    39.     public IEnumerator Process(GameObject prefab, int size)
    40.     {
    41.         if (loaded != -1)
    42.         {
    43.             Destroy(transform.GetChild(0).gameObject);
    44.         }
    45.         loaded = index;
    46.         float offset = (dimensions / 2) - 0.5f;
    47.         var parent = new GameObject();
    48.         parent.transform.parent = transform;
    49.        
    50.         for (int x = 0; x < size; x++)
    51.         {
    52.             for (int y = 0; y < size; y++)
    53.             {
    54.                 var go = GameObject.Instantiate(prefab) as GameObject;
    55.                 go.transform.position = new Vector3(x - offset, 0, y - offset);
    56.                 go.transform.parent = parent.transform;
    57.             }
    58.             yield return null;
    59.         }
    60.         processing = false;
    61.     }
    62. }
    63.  
    As you can see there is some code in there to react to key presses and stuff like that. But the actual line of code that does the magic is just:
    Code (csharp):
    1.  
    2. var go = GameObject.Instantiate(prefab) as GameObject;
    3.  
    You mention the resources folder and I could fear that somehow Unity doesn't catch the references to the shader. Try linking just one of the Prefabs with a direct scene reference like the public GameObject[] prefabs field in my code snippet. That will ensure that Unity doesn't attempt to "optimize" something that shouldn't be optimized. Dragging the prefab into your game scene and seeing it working there is a good test to see if all script and shader references are recognized.

    Regards,
    Joen Joensen, UnLogick.
     
  2. Ya_hen

    Ya_hen

    Joined:
    Nov 25, 2013
    Posts:
    15
    Ok, I save prefab with help of this code:
    " UMA.PowerTools.PowerToolsRuntime.SaveCharacterPrefab("Assets/Resources", "Player", prefab); ".
    And then instantiate it in other scene:

    var player = Resources.Load("Player");
    player = Instantiate(player);

    And it works good for me when i run it from unity. $Untitled.png
    but when I build and run my project nothing happens when i press play

    P.S.
    That I get from log file:
    NotImplementedException: SaveCharacterPrefab Cannot save a prefab outside of the Unity environment. This method only works in the editor!
    at PlayButtonScript.OnClick () [0x00000] in <filename unknown>:0
     
    Last edited: Feb 19, 2014
  3. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Ok, I think I might finally understand what you're telling me. At run-time you want:

    scene 1 - Save Prefab
    scene 2 - Load Prefab

    However the prefab system is an integrated part of Unity, and you can only create prefabs inside the Unity Editor. You cannot save data into the "Assets/Resources" location outside the editor.

    However if all you want is the ability to let a UMA character survive a scene load you can set the hideFlags = HideFlags.DontSave on all the objects(gameobjects, textures, materials, etc) and then Unity will let them survive a scene reload. On most platforms you'll need to check the convert render textures option on the UMA generator.

    Let me know if this was helpful.
     
  4. Ya_hen

    Ya_hen

    Joined:
    Nov 25, 2013
    Posts:
    15
    In future I want to do mmorpg game. And I want to make authoritative server and save all prefabs on it. When player login in game, prefab should be loaded from server ( to make prefab inaccessible to change by user ). But in your code, player should create avatar every time before game. I need to save prefab. Do you understand me?
    Or you can tell me another way to make it.. Maybe I don't know something in Unity that can help.
     
    Last edited: Feb 20, 2014
  5. Mikie

    Mikie

    Joined:
    Dec 27, 2011
    Posts:
    367
    Hi Joen,

    Do you think you could ever make PT create an avatar like in a fbx file that would not require UMA to not be present?
     
  6. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Yes I understand. There a multiple ways to do this:

    With Unity Pro License:

    • On a server launch Unity CommandLine and tell it to build the character, tell it to save the prefab (using powertools) and create an assetbundle. Then store that asset bundle on the server and send it to the clients.
    • Only store the recipe on the server, with Unity Pro building a character takes only a few milliseconds, it's probably faster than to transfer the full character through a socket.

    Without Unity Pro License:

    • Build the UMA character, save the textures to png, serialize the mesh, send the serialized mesh and the textures to the client.

    The two pro routes are without a doubt the easiest, but it's all possible. However notice that only the first suggestion actually uses a prefab, and that is because prefabs can only be created inside Unity, similarly they can only be build directly into the client or passed through an asset bundle!

    The Prefabs works without UMA! However you still need shaders and scripts attached to your UMA characters. But that's like 4 files not the entire UMA package!
     
  7. Mikie

    Mikie

    Joined:
    Dec 27, 2011
    Posts:
    367
    Joen, yes I see it now. The rig is there. So do have some cartoon and monster characters ready to go?
     
  8. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    527
    @Ya_hen: adding to what Joen wrote: I am also developing a game currently, where the avatars are stored centrally. The user can modify his avatar which will be uploaded to the central storage and others can see it on their side of the online game by downloading it.

    The way I did is was to get Joen's tools that can serialize recipes very efficiently. I use the free version of Kii.com to upload the recipes there. I have my own script which allows me to easily instantiate any character from a recipe. This takes no time at all and only one default prefab per character, the one with my instantiate script on it, into which I feed the recipe. This might be also a way forward for you.
     
  9. Arcanor

    Arcanor

    Joined:
    Nov 4, 2009
    Posts:
    283
    Hi Joen. I've just purchased the PT and RT packages. Your video tutorials are perfect for beginners trying to understand what the packages do, and how to get them to work in a basic way. I purchased both packages based on the strength of your videos. Things are looking great so far, nice work!

    Now that I've got them, I'm having a question about the threaded generator that comes with PT. I notice that in your tutorial video #3, you do mention that there is a "tiny amount" more flicker when using a slider to update the avatar in real time, however I'm finding it quite distracting as I work on a custom character generator for my game. Should I just be sticking with the original UMAGenerator while doing real time updates, and then swap it out for the new UMAGeneratorThreaded when saving? Or alternatively, is there some setting that will mitigate the flickering?
     
  10. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Thanks, I appreciate it!

    I recommend using the two Generator approach, doing bone baking while dragging a slider is vast overkill!

    I could go into the whole build a new copy and only replace the old one when it's done. But measured in pure ms from change to final output the UMAGenerator is slightly faster (assuming you have pro, otherwise the UMAGeneratorThreaded is vastly superior), but that makes it the optimal solution for a situation where you want a live feel of constant updates. So since the UMAGenerator already exists and does a fantastic job at fast live updating I haven't considered it worth the effort of adding the complexity to the Power Tools.
     
  11. Arcanor

    Arcanor

    Joined:
    Nov 4, 2009
    Posts:
    283
    Makes sense, and will do. Thanks!
     
  12. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    I've been having glitchy behavior from power tools mostly when using it with Helper to create prefabs of characters with custom slots. I'm running it in a completely clean project on the newest version of UMA, power tools, helper and nothing else and with the slot fix applied. I've talked with Kirby and it seems like power tools is the issue.

    Sometimes when attempting to create a prefab it fails with this error. Note the character seems fine and shows no display errors so it does have textures properly applied:
    Code (csharp):
    1.  
    2. NullReferenceException: Object reference not set to an instance of an object
    3. UMA.PowerTools.UMASaveCharacters.SaveCharacterPrefab (System.String assetFolder, System.String name, UMA.UMAData umaData) (at Assets/UMA/Extensions/UMAPowerTools/Scripts/Editor/SaveCharactersPrefab.cs:92)
    4. UMA.PowerTools.UMASaveCharacters.SaveCharacterPrefabsMenuItem () (at Assets/UMA/Extensions/UMAPowerTools/Scripts/Editor/SaveCharactersPrefab.cs:79)
    5.  
    Sometimes when playing a scene where I've saved a prefab Unity crashes. Last entry in the log:
    Code (csharp):
    1.  
    2. Destroying assets is not permitted to avoid data loss.
    3. If you really want to remove an asset use DestroyImmediate (theObject, true);
    4. UnityEngine.Object:DestroyImmediate(Object, Boolean)
    5. UnityEngine.Object:DestroyImmediate(Object) (at C:\BuildAgent\work\d3d49558e4d408f4\artifacts\EditorGenerated\UnityEngineObject.cs:125)
    6. UMA.UMAData:cleanMesh(Boolean)
    7. UMA.PowerTools.<workerMethod>d__0:MoveNext()
    8. UMA.WorkerCoroutine:Work()
    9. UMA.PowerTools.UMAGeneratorThreaded:Work() (at Assets\UMA\Extensions\UMAPowerTools\Scripts\UMAGeneratorThreaded.cs:333)
    10. UMA.PowerTools.UMAGeneratorThreaded:LateUpdate() (at Assets\UMA\Extensions\UMAPowerTools\Scripts\UMAGeneratorThreaded.cs:241)
    11.  
    Finally sometimes my prefabs actually become corrupted after creation. I'll create a prefab and it seems fine and I'll even drop it in a scene but then later I click on it and Unity crashes and the prefab goes blank (it used to be 500-800kb but now it is 5kb). The crash error:

    Code (csharp):
    1.  
    2. NullReferenceException: Object reference not set to an instance of an object
    3. UnityEditor.TreeViewDragging.DragElement (UnityEditor.TreeViewItem targetItem, Rect targetItemRect) (at C:/BuildAgent/work/d3d49558e4d408f4/Editor/Mono/GUI/TreeView/TreeViewDragging.cs:148)
    4. UnityEditor.TreeView.HandleUnusedMouseEventsForNode (Rect rect, UnityEditor.TreeViewItem item) (at C:/BuildAgent/work/d3d49558e4d408f4/Editor/Mono/GUI/TreeView/TreeView.cs:299)
    5. UnityEditor.TreeView.OnGUI (Rect rect, Int32 keyboardControlID) (at C:/BuildAgent/work/d3d49558e4d408f4/Editor/Mono/GUI/TreeView/TreeView.cs:404)
    6. UnityEditor.ProjectBrowser.OnGUI () (at C:/BuildAgent/work/d3d49558e4d408f4/Editor/Mono/ProjectBrowser.cs:1724)
    7.  
    Note the textures and recipe of the prefab are still there the prefab itself is just corrupted. For most of the corrupted ones if I select the recipe (I have the recipe pack) I can't create a prefab from the recipe either though I can click show and it looks fine.
     
    Last edited: Feb 25, 2014
  13. Ya_hen

    Ya_hen

    Joined:
    Nov 25, 2013
    Posts:
    15
    Hello, thanks for your adding. Maybe you can show me how to save recipe and instantiate character from recipe during runtime? ( code, little scene ).
     
  14. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    527
    Hi,

    here is the code I am using for storing and loading the recipes:

     
  15. Ya_hen

    Ya_hen

    Joined:
    Nov 25, 2013
    Posts:
    15
    Thanks, but how you create avatar from recipe?? I hard coded it) But can you show me your script, please?)
     
    Last edited: Mar 6, 2014
  16. Ya_hen

    Ya_hen

    Joined:
    Nov 25, 2013
    Posts:
    15
    Anyone can help me???
    I know how to get recipe from avatar. I need to know how to create avatar from this recipe in other scene.
     
  17. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Select the avatar in the scene view and use the menu item: "UMA|Load and Save|Save ... " The built in UMA supports saving as text if you own the recipe tools then you got a few binary formats as well. The code that does the actual saving is:
    Code (csharp):
    1.  
    2. var asset = ScriptableObject.CreateInstance<UMATextRecipe>();
    3. asset.Save(umaData.umaRecipe, umaContext);
    4. byte[] data = asset.GetBytes();
    5. System.IO.File.WriteAllBytes(path, data);
    6. ScriptableObject.Destroy(asset);
    7.  
    If you own the recipe tools you can replace UMATextRecipe with BinaryRecipeFloat, BinaryRecipe16Bit or BinaryRecipe8Bit. Found in the UMA.RecipeTools namespace.

    Hope this helps
    Joen Joensen, UnLogick
     
  18. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    527
    I created a rather lengthy general script for that by taking the crowd scene as a base and radically reimplementing things there so that instead of many characters you can reliably spawn individual ones that are either random or supply a recipe if you don't want random appearance. You can also supply a different shader (e.g. for cartoon style), initial animation state etc.

    I thought about putting this up for cheap money on the asset store. Would this be interesting to others? I will constantly update and refine it as my games progress and become more sophisticated.
     
  19. SirManGuy

    SirManGuy

    Joined:
    Sep 16, 2010
    Posts:
    33
    Blargh, I've run into an issue and it could be about 700 different things at this point. I've got basic UMA working in my project but as I switch to the UMAGeneratedThreaded I hit an error with a texture:

    System.Exception: Exception in WorkerCoroutine: UMA.CopyColorizedTextureRectCoroutine ---> System.IndexOutOfRangeException: Array index is out of range.
    at UMA.CopyColorizedTextureRectCoroutine+<workerMethod>d__0.MoveNext () [0x0012c] in d:\Projects\10 - Source Code\UMA\UMADLL\UMA\CopyColorizedTextureRectCoroutine.cs:56
    at UMA.WorkerCoroutine.Work () [0x000b5] in d:\Projects\10 - Source Code\UMA\UMADLL\UMA\WorkerCoroutine.cs:70
    --- End of inner exception stack trace ---
    at UMA.WorkerCoroutine.Work () [0x000c9] in d:\Projects\10 - Source Code\UMA\UMADLL\UMA\WorkerCoroutine.cs:74
    at UMA.PowerTools.TextureProcessIndieThreadedCoroutine.DoThreadedWork (UMA.PowerTools.PoliteThreadAbortHandler abortHandler) [0x002c7] in D:\Projects\10 - Source Code\SandboxRPG\SandboxRPG Client\Assets\UMA\Extensions\UMAPowerTools\Scripts\TextureProcessIndieThreadedCoroutine.cs:105
    at UMA.PowerTools.TextureProcessIndieThreadedCoroutine.ThreadedWorkerFunction (UMA.PowerTools.PoliteThreadAbortHandler abortHandler) [0x0001c] in D:\Projects\10 - Source Code\SandboxRPG\SandboxRPG Client\Assets\UMA\Extensions\UMAPowerTools\Scripts\TextureProcessIndieThreadedCoroutine.cs:47
    at UMA.PowerTools.UMAGeneratorThreaded.ProcessWorkJob (UMA.PowerTools.UMAThreadedWorkJob workJob) [0x0000b] in D:\Projects\10 - Source Code\SandboxRPG\SandboxRPG Client\Assets\UMA\Extensions\UMAPowerTools\Scripts\UMAGeneratorThreaded.cs:175
    at UMA.PowerTools.UMAGeneratorThreaded.WorkerThreadFunction () [0x00070] in D:\Projects\10 - Source Code\SandboxRPG\SandboxRPG Client\Assets\UMA\Extensions\UMAPowerTools\Scripts\UMAGeneratorThreaded.cs:125
    UnityEngine.Debug:LogError(Object)
    UMA.PowerTools.UMAGeneratorThreaded:Work() (at Assets/UMA/Extensions/UMAPowerTools/Scripts/UMAGeneratorThreaded.cs:294)
    UMA.PowerTools.UMAGeneratorThreaded:LateUpdate() (at Assets/UMA/Extensions/UMAPowerTools/Scripts/UMAGeneratorThreaded.cs:241)

    Any suggestions on tracking down the issue? I've had issues with textures in the base of UMA but I thought I had them all resolved now. Switching back to the standard generator is fine.
     
  20. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Good call to get me the single threaded call stack, the call stack clearly indicates that it's a missing safety check before calling CopyColorizedTextureRectCoroutine (it's a fairly simple copy rect coroutine, the same method as the normal UMA generator uses, if it fails it was called incorrectly!)

    Come to think of it I did add some safety checks to the regular UMA Generator, and I believe I forgot to check if the Power Tools had the same vulnerabilities. I'll be checking the changelog to see what safety check I added to UMA and make sure to integrate the same checks into the Power Tools.

    Since UMA 1.1 was released yesterday an update to the Power Tools was already in the works. I expect to upload a new version perhaps as soon as tomorrow.

    Thanks for reporting the issue,
    Joen Joensen, UnLogick
     
  21. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Power Tools 1.1.0.0 available on the asset store.
    It is now matching the UMA 1.1.0.0 api without warnings.
    Empty overlays now allowed.
    Multiple Shader fix of UMA 1.1.0.0 has been duplicated into the threaded Generator.

    Known Bugs:
    Additional Bones still not working with Threaded Generator!

    SirManGuy can you please grab the new version and confirm that adding the safety checks fixed your problem? If not I'll have to dig deeper.
     
  22. SirManGuy

    SirManGuy

    Joined:
    Sep 16, 2010
    Posts:
    33
    Will do, I'll try to get it done today but I'm writing a data manager for my inventory/equipment -> UMA and have about 6 broken pieces atm!

    Update: Ayup still having the same error, I'm guessing it is something with my set up. I'll take a closer look myself this week, if you have any suggestions on where to start poking around let me know.

    Thanks!
     
    Last edited: Mar 17, 2014
  23. SirManGuy

    SirManGuy

    Joined:
    Sep 16, 2010
    Posts:
    33
    Okay I'm not certain what is going on, I'm still getting a few issues and I'm running into a problem where
    resolutionScale = atlas.resolutionScale * atlas.atlasMaterialDefinitions.source.slotData.overlayScale;
    is returning 0.5f for TextureProcessIndieThreaded, but it is 1.0f for non-threaded.

    I'm hoping you can have some guidance on tracking down where my data might be wrong, I have a feeling it is something in my UMA/Slot/Overlay set up that is causing this.
     
  24. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745


    Interesting, I'll try to take a look. There should be no such difference.
     
  25. SirManGuy

    SirManGuy

    Joined:
    Sep 16, 2010
    Posts:
    33
    Hah everytime I think I make a step in the right direction things go from bad to worse. I'm now getting:
    Quaternion To Matrix conversion failed because input Quaternion is invalid {-1.#IND00, -1.#IND00, -1.#IND00, -1.#IND00} l=-1.#IND00

    And looking at the armature I can see why

    Any suggestions?
     

    Attached Files:

    Last edited: Mar 28, 2014
  26. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Is your asset Armature also looking like that? Or is it only run-time?

    At this point it might be easier if you send me the offending fbx files and let me take a look.
     
  27. SirManGuy

    SirManGuy

    Joined:
    Sep 16, 2010
    Posts:
    33
    It is the standard UMA male model that I'm getting this issue at run-time. I've moved the files to the Resources folder and I did this prior to 1.1 so it is possible I didn't re-update them to the latest version. I'm going to try to make a new project and start from scratch on this problem, if I can reproduce it there I'll be able to send you a full project as I think that would be the best way for you to track it down (or me!)

    Thanks Joen!
     
  28. SirManGuy

    SirManGuy

    Joined:
    Sep 16, 2010
    Posts:
    33
    Okay I've made some progress on my issues. I think the texture issues I was having were possibly solved by deleting and rebuilding my UMA import.

    It turns out my set up is not friendly with UMAGeneratorThreaded. I've got a completely different process for characters and load UMA into a base for the networking pieces as UMA is just one of many races possible. With that I've changed the root UMA prefab to drop the empty game object that houses the UMA details.

    This new prefab is what is set up as the prefab for the RaceSlot->RaceData. What happens with this set up is the Quaternion issue above. However with my testing I discovered that if I used the UMAGenerator first to create a character with this set up then all characters after work fine with UMAGeneratorThreaded. To set this up all you need to do is remove Male_Unified and create it as a prefab and use that in the RaceData.

    Next I've run into a new issue due to how UMAGeneratorThreaded deals with the bones as you can see below. This happens if I have any rotation on the object that will have UMA added to it before UMAGeneratorThreaded processes. I've been able to show this in the base PowerTools/Scenes/auto loader by spinning Lucy by 180 on y:

     
  29. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Could you make a clear and simple repro step list? Please be very specific and mention just one operation at a time. I get the idea of what you're doing but in my experience a clear list of repro steps is the only thing that ensures that we'll be talking about the same thing. (A video would also work)

    You should take care not to change Lucy's position while the Generator is working. Changing before or after should be fine.
     
  30. Dirrogate

    Dirrogate

    Joined:
    Feb 18, 2014
    Posts:
    157
    ... no seriously... but let me explain a bit more.
    system: Latest Unity Pro (4 month pro license with Oculus Rift)
    UMA plugin integrated
    UMA Power Tools bought and integrated into UMA/Extensions.

    I've saved a character as a prefab successfully from UMA Power Tools and can successfully import it into a scene (for PC)
    When I switch to Android development mode the same character shows this funky texture pattern on the skin/clothes.
    See attached pic: $Uma_PrefaB_error_texture.jpg

    and another closeup
    $Uma_PrefaB_error_texture2.jpg

    I'm a newbie to Unity so any help will be appreciated (also cant code for the life of me, so I use Playmaker, so go easy on me if it involves wrangling with scripts)
    Kind Regards.
     
  31. SirManGuy

    SirManGuy

    Joined:
    Sep 16, 2010
    Posts:
    33
    Okay to smash Lucy to smithereens like you see in my screen shot above:
    1. Open Scene101 - auto loader.unity
    2. Click on Lucy (I used #2 since it is closest) and rotate her 180 on y
    3. Click play and watch the fun begin

    I've got to make up the steps for the other issue
     
  32. SirManGuy

    SirManGuy

    Joined:
    Sep 16, 2010
    Posts:
    33
    To reproduce the problem of the broken NaN rotations/positions of the bone structure:
    1. Open Updated Scene01 - crowd.unity
    2. /UMA/UMA_Assets/Races - drag UMA_Human_Male to the scene
    3. Expand UMA_Human_Male on scene hierarchy and drag Male_Unified into Races folder to create a prefab
    4. /UMA/UMA_Assets/Races - duplicate Human Male
    5. Update "Human Male 1" to use Male_Unified for Race Prefab
    6. Update UMA-> RaceLibrary to use "Human Male 1" as the Male race for Element 1
    7. Change UMACrowd to generate one avatar
    8. Run and rerun until it randomly generates a Male (or change the Race Library to Male only)

    Sorry if this is really overly simplified steps I've taught what "double-click" means and I have a tendency to oversimplify!

    Thanks,
    Jason
     
  33. Dirrogate

    Dirrogate

    Joined:
    Feb 18, 2014
    Posts:
    157
    Ok, the texture problem seems to be solved. I followed your clue and switched project from PC to Iphone and the textures were fine.
    But when I switched to Android they were getting compressed/messed up.

    I then clicked each texture (in android development mode) and chose true color, which has fixed it.
    (I'm still learning so please do bear with any newbie questions I might throw around)

    Kind Regards.
     
  34. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    I might have said something to help you, but I wasn't actually aware that this was a platform thing. I thought UMA shaders was immune to the platform changes. Thanks for the heads up.

    And newbie questions are more than welcome.
     
  35. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    omg, you're quite right. When the hell did this break?

    The code being executed here is the same as in the video I did of the steam city. And that clearly allows full rotation no problems.

    I'll get right on this, seems like a high priority bug to me.

    Let me just do this first and get back to the race thing after.
     
  36. FernandoRibeiro

    FernandoRibeiro

    Joined:
    Sep 23, 2009
    Posts:
    1,362
    Hey =)
    It was a compression issue. Android compression gerenates quite ugly artifacts :p
    But I´m aware we have problems with non square textures and IOS dev, in case of compressing textures.
    Have a great weekend :)
     
  37. Narcotic904

    Narcotic904

    Joined:
    Jun 11, 2013
    Posts:
    14
    I am using photon networking and I have to instanciate a prefab as my player like so

    Code (csharp):
    1. PhotonNetwork.Instantiate(this.playerPrefab.name,transform.position, Quaternion.identity, 0);
    after that I have attempted to set the recipe string multiple times different ways trying to get it to work, any idea how I can do that?
     
  38. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    You're not being very specific and so it's hard for me to determine what is wrong. Let me just tell you how I would make it work.

    1. The Scene should have a gameobject called "UMAContext" with a UMAContext component pointing to valid libraries.
    2. The PlayerPrefab should have a UMADynamicAvatar or AutoLoaderAvatar
    3. And then the code should look something like this:
    Code (csharp):
    1.  
    2. var recipe = CreateInstance<UMATextRecipe>();
    3. recipe.SetBytes(System.Text.Encoding.UTF8.GetBytes (recipeString)); // recipe.recipeString = data;
    4. DynamicAvatar.recipe = recipe;
    5. DynamicAvatar.Show();
    6. Destroy(recipe);
    7.  
    You can use the recipe.recipeString if you really want but I advice you to store the recipe as binary data in a byte[] instead and use GetBytes and SetBytes.
     
  39. KrayonZA

    KrayonZA

    Joined:
    Mar 5, 2013
    Posts:
    52
    Hi Narcotic904

    You can store the information for the player in a static variable in your character creator and then pass the game object along from scene to scene:

    Code (csharp):
    1.  
    2. void Awake ()
    3. {
    4.   DontDestroyOnLoad (gameObject);  
    5. }
    6.  
    When the the time comes to instantiate your character you can pass the information to photon by adding it as object data.

    Code (csharp):
    1.  
    2. string[] charPref = new string[1];
    3.  
    4. charPref[0] = Info.ReturnCharacterRecipe(); // Return Character Recipe
    5.  
    6. // Destroy gameobject with Static variables
    7. Destroy(gameobjectstatic);
    8.  
    9. object[] objs = new object[1];
    10. objs[0] = charPref;
    11.  
    12. PhotonNetwork.Instantiate(playerPrefab.name, position, rotation, 0, objs); // Instantiate the network player
    13.  
    Create a player info sort of script to retrieve the string just remember you can only access the photon view from the same game object where it is attached that's why i'm not just loading it directly into UMADynamicAvatar.

    Code (csharp):
    1.  
    2. _photonView = gameObject.GetComponent<PhotonView>();
    3. object[] data = _photonView.instantiationData;
    4.  
    5. for (int i = 0; i < data.Length; i++)
    6.         {
    7.             string[] innerArray = (string[])data[i];
    8.             for (int a = 0; a < innerArray.Length; a++)
    9.             {
    10.                 race    = innerArray[0].ToString();
    11.             }
    12.         }
    13.  
    Then on UMADynamicAvatar you can load the recipe and call it when needed

    Code (csharp):
    1.  
    2.     void LoadUMARecipe ()
    3.     {
    4.  
    5.         playerInfo = gameObject.transform.root.gameObject.GetComponent<PlayerInfo>();
    6.        
    7.         if (playerInfo.race != null) {
    8.             bytes = System.Convert.FromBase64String (playerInfo.race);
    9.             if (bytes != null) {
    10.                 var asset = ScriptableObject.CreateInstance<BinaryRecipe8Bit> ();
    11.                 asset.data = bytes;
    12.                
    13.                 if (asset != null) {
    14.                     Load (asset);
    15.                     if (debug) Debug.Log ("Loading Character");
    16.                 }
    17.                
    18.             }
    19.         }
    20.     }
    21.  
    22.  
    You can probably take out System.Convert.FromBase64String im just using that for an easier way to store the information into a MySQL database, I'm using this to store a lot more than just the character recipe string so it can be used for other things if you add more to the array.
     
    Last edited: Apr 6, 2014
  40. Narcotic904

    Narcotic904

    Joined:
    Jun 11, 2013
    Posts:
    14
    Thanks I will test this out in one moment, just noticed something though wouldn't it be kind of slow to store something that large of an entry to mysql?
     
  41. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Even using Text serialization the strings are not large enough to cause mysql immediate problems, you would need a lot(millions!) of characters before mysql was troubled.

    However it does take io/network bandwidth which is why I created the Recipe Tools, capable of storing the same recipes in roughly 1/20 of the size! Being able to switch the the Binary Recipes in the Recipe Tool requires using the GetBytes and SetBytes methods instead of the recipe string which only works for uma default text serialization.
     
  42. KrayonZA

    KrayonZA

    Joined:
    Mar 5, 2013
    Posts:
    52
    Its tiny after using the recipe tools and base64 encoding it.
     
  43. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    I would believe it was even smaller using recipe tools and a blob. Base64 actually makes it larger.
     
  44. KrayonZA

    KrayonZA

    Joined:
    Mar 5, 2013
    Posts:
    52
    Yeah ill probably switch to a blob at the later stage, it just makes it a little too complicated for me at this stage in development at the moment its something around 20 bytes.
     
  45. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    527
    I finally got around actually using some of the scripts. My highest hopes are in the threaded generator. Is there anything I have to be aware of or is it a drop in replacement?

    When I drag/drop the UMAGeneratorThreaded onto the UMAGenerator script it hides some variables which I guess is ok since your script does not need all of them but when the characters come up they are all screwed up. See pictures below of good and bad, where bad is done with the threaded. Any ideas why this might be happening? No errors in log, Unity Pro.

    $uma_powertools.PNG $uma_powertools_good.PNG
     
  46. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    Aww, I knew I added a bug in there when I was working on additional bones, but this is terrible. I'm really sorry about that. The idea is that it's a drag and drop replacement. So there is nothing you should be aware of, except this is my bad!

    Can you please send me those models and I'll look right into fixing this bug in the following week.

    Regards,
    Joen
     
  47. ImpossibleRobert

    ImpossibleRobert

    Joined:
    Oct 10, 2013
    Posts:
    527
    I am not really sure how to send you the models. What exactly do you need? The base model is the default UMA one with some additional slots attached. I would need to create a project for you including all the slots and overlays. This will be quite some effort. Don't get me wrong, but is this really needed when you already have a suspicion where the bug could be?
     
  48. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    No, I just wanted to be sure I solved your problem while I was at it.

    Hold on while I fix this and let me know if the fix didn't work for you.
     
  49. S-P-A-C-E-D

    S-P-A-C-E-D

    Joined:
    Jan 11, 2014
    Posts:
    45
    How can I adjust the feet, they point out so much and it looks very awkward when my run and walk animations are played.

    Also, if I'm am using umazing to get the editor in game would it be on uma or umazing that the default scripts the character spawns with. As in ill need to have my own player controller and rigid bodies spawn with the character.
     
  50. UnLogick

    UnLogick

    Joined:
    Jun 11, 2011
    Posts:
    1,745
    look at the code file: UMA/UMA_Assets/DNA/HumanMaleDNAConverterBehaviour.cs

    The solution you're looking for should be something like adding:
    skeleton.SetRotation(UMASkeleton.StringToHash("LeftFoot"), Quaternion.Euler(0, 10, 0));

    Or you could look at the TutorialDNA and mirror that to create your own DNA to allow you to set the foot angle.

    Look at the RacePrefab, that's what you need to change!