### Default Physics Layers in UMA Source: https://github.com/umasteeringgroup/uma/wiki/Cloth Defines the default physics layer configurations used by UMA for ragdoll and non-colliding objects. These constants are crucial for setting up collision detection and physics interactions for cloth and other character elements. ```csharp static int _defaultRagdollLayer = 8; static int _noCollisionLayer = 10; ``` -------------------------------- ### Update UMA Breast Jiggle Stiffness (C#) Source: https://github.com/umasteeringgroup/uma/blob/master/UMAProject/Assets/UMA/Examples/Physics Examples/UMA_JiggleMaster/UpdatingJiggleBonesAtRuntime.txt This script updates the `_breastStiffness` public variable of the `UMA_JiggleBreasts` component. It requires a `MonoBehaviour` script in Unity and assumes the component is attached to the same GameObject. The `UpdateJiggleBone` method needs to be called for each managed jiggler bone after parameter changes. ```csharp using UnityEngine; using UMA.DP3.Jiggles; public class JiggleTest : MonoBehaviour { private UMA_JiggleBreasts breastJiggle; void Start () { breastJiggle = GetComponent(); } void Update () { if (Input.GetKeyDown(KeyCode.Space)) { breastJiggle._breastStiffness = 1; // For breast and buttocks where more than one bone is managed you need to call UpdateJiggleBone() // for each bone in the list _jigglers after chaging parameters in code for belly you will not. for (int i = 0; i < breastJiggle._jigglers.Count; i++) { breastJiggle.UpdateJiggleBone(breastJiggle._jigglers[i]); } } } } ``` -------------------------------- ### Manage UMA Assets using Global Library and Indexer (C#) Source: https://context7.com/umasteeringgroup/uma/llms.txt This C# code snippet illustrates how to access and utilize the UMAAssetIndexer for managing global assets within the UMA system. It shows how to retrieve all assets of a specific type (races, wardrobe recipes, slots, overlays) and how to fetch individual assets by name or search for compatible wardrobe items for a given race. This requires the UMA and UnityEngine namespaces. ```csharp using UMA; using UnityEngine; using System.Collections.Generic; public class LibraryManager : MonoBehaviour { void Start() { // Access the global asset indexer singleton UMAAssetIndexer indexer = UMAAssetIndexer.Instance; // Get all races List races = indexer.GetAllAssets(); Debug.Log($"Found {races.Count} races in library"); // Get all wardrobe recipes List wardrobeRecipes = indexer.GetAllAssets(); Debug.Log($"Found {wardrobeRecipes.Count} wardrobe recipes"); // Get specific asset by name UMAWardrobeRecipe shirt = indexer.GetAsset("MaleShirt01"); if (shirt != null) { Debug.Log($"Found wardrobe recipe: {shirt.name}"); } // Get all slots List slots = indexer.GetAllAssets(); Debug.Log($"Found {slots.Count} slot assets"); // Get all overlays List overlays = indexer.GetAllAssets(); Debug.Log($"Found {overlays.Count} overlay assets"); } public void FindAssetsByTag(string tag) { UMAAssetIndexer indexer = UMAAssetIndexer.Instance; // Search for wardrobe items with specific tag List recipes = indexer.GetAllAssets(); foreach (UMAWardrobeRecipe recipe in recipes) { // Check if recipe has the tag (implementation depends on your tagging system) Debug.Log($"Recipe: {recipe.name}"); } } public void GetCompatibleWardrobeForRace(string raceName) { UMAAssetIndexer indexer = UMAAssetIndexer.Instance; RaceData race = indexer.GetAsset(raceName); if (race != null) { List allWardrobe = indexer.GetAllAssets(); foreach (UMAWardrobeRecipe recipe in allWardrobe) { // Check compatibility with race if (recipe.compatibleRaces.Contains(raceName)) { Debug.Log($"Compatible wardrobe: {recipe.name}"); } } } } } ``` -------------------------------- ### Control UMA Generator to Create Characters (C#) Source: https://context7.com/umasteeringgroup/uma/llms.txt This snippet demonstrates how to initialize and use the UMAGeneratorBase to create a character. It covers finding or creating a generator instance, setting up UMAData with race and slot information, subscribing to character creation events, and triggering the generation process. Dependencies include the UMA and UnityEngine namespaces. ```csharp using UMA; using UnityEngine; public class GeneratorController : MonoBehaviour { public UMAGeneratorBase generator; void Start() { // Get or create UMA Generator if (generator == null) { generator = FindObjectOfType(); if (generator == null) { GameObject genGO = new GameObject("UMA Generator"); generator = genGO.AddComponent(); } } } public void CreateCharacterWithGenerator() { // Create UMAData GameObject avatarGO = new GameObject("Generated Avatar"); UMAData umaData = avatarGO.AddComponent(); // Initialize UMA recipe umaData.umaRecipe = new UMAData.UMARecipe(); // Get race data UMAAssetIndexer indexer = UMAAssetIndexer.Instance; RaceData race = indexer.GetAsset("HumanMale"); if (race != null) { umaData.umaRecipe.SetRace(race); // Add slots SlotDataAsset torsoSlot = indexer.GetAsset("MaleTorso"); if (torsoSlot != null) { SlotData slot = new SlotData(torsoSlot); umaData.umaRecipe.SetSlot(slot); } // Subscribe to events umaData.CharacterCreated = new UMADataEvent(); umaData.CharacterCreated.AddListener(OnGeneratorCharacterCreated); // Set generator reference umaData.umaGenerator = generator; // Dirty the UMA to trigger generation generator.addDirtyUMA(umaData); } } void OnGeneratorCharacterCreated(UMAData umaData) { Debug.Log("Generator created character successfully"); } public void GetGeneratorStatus() { if (generator != null) { Debug.Log($"Generator queue size: {generator.QueueSize}"); Debug.Log($"Generator is active: {generator.gameObject.activeInHierarchy}"); } } } ``` -------------------------------- ### Create Dynamic Character Avatar from Scratch (C#) Source: https://context7.com/umasteeringgroup/uma/llms.txt This script demonstrates how to create a new dynamic character avatar in Unity using the UMA framework. It sets the race, configures DNA for body proportions, adds wardrobe items, sets colors, and subscribes to the character creation event. It requires the UMA.CharacterSystem namespace and a RuntimeAnimatorController. ```csharp using UMA; using UMA.CharacterSystem; using UnityEngine; using System.Collections.Generic; public class CreateCharacter : MonoBehaviour { public string raceName = "HumanFemale"; public RuntimeAnimatorController animController; public List wardrobeItems; void Start() { // Create new GameObject with DynamicCharacterAvatar component GameObject characterGO = new GameObject("MyCharacter"); characterGO.transform.localRotation = Quaternion.Euler(0f, 180f, 0f); DynamicCharacterAvatar avatar = characterGO.AddComponent(); // Set the race (HumanMale, HumanFemale, etc.) avatar.RacePreset = raceName; avatar.raceAnimationControllers.defaultAnimationController = animController; // Configure DNA to customize body proportions avatar.predefinedDNA = new UMAPredefinedDNA(); avatar.predefinedDNA.AddDNA("headSize", 0.9f); avatar.predefinedDNA.AddDNA("height", 1.1f); avatar.predefinedDNA.AddDNA("breastSize", 0.7f); // Add wardrobe items (clothing, accessories) foreach (UMAWardrobeRecipe recipe in wardrobeItems) { avatar.preloadWardrobeRecipes.recipes.Add( new DynamicCharacterAvatar.WardrobeRecipeListItem(recipe) ); } // Set colors for shared color channels avatar.SetColor("Hair", new Color(0.8f, 0.2f, 0.1f)); avatar.SetColor("Skin", new Color(0.9f, 0.7f, 0.6f)); // Subscribe to character creation event avatar.CharacterCreated = new UMADataEvent(); avatar.CharacterCreated.AddListener(OnCharacterCreated); // Position and activate characterGO.transform.position = new Vector3(0f, 0.5f, 0f); characterGO.SetActive(true); } void OnCharacterCreated(UMAData umaData) { Debug.Log($"Character created with {umaData.rendererCount} renderers"); } } ``` -------------------------------- ### Save and Load UMA Character Recipes (C#) Source: https://context7.com/umasteeringgroup/uma/llms.txt This C# script allows saving and loading UMA character configurations, including recipes, avatar definitions, and compressed formats. It utilizes Unity's `Application.persistentDataPath` for file storage. Requires `UMA.CharacterSystem` and `UnityEngine` namespaces. ```csharp using UMA; using UMA.CharacterSystem; using UnityEngine; using System.IO; public class CharacterPersistence : MonoBehaviour { public DynamicCharacterAvatar avatar; private string savePath; void Awake() { savePath = Path.Combine(Application.persistentDataPath, "characters"); if (!Directory.Exists(savePath)) { Directory.CreateDirectory(savePath); } } public void SaveCharacter(string characterName) { // Get recipe string (includes wardrobe, colors, DNA) string recipeString = avatar.GetCurrentRecipe(); // Save to file string filePath = Path.Combine(savePath, $"{characterName}.txt"); File.WriteAllText(filePath, recipeString); Debug.Log($"Character saved to {filePath}"); } public void SaveAsAvatarDefinition(string characterName) { // Get compressed avatar definition (smaller file size) string avatarDefString = avatar.GetAvatarDefinitionString(true); // Save to file string filePath = Path.Combine(savePath, $"{characterName}_def.txt"); File.WriteAllText(filePath, avatarDefString); Debug.Log($"Avatar definition saved (size: {avatarDefString.Length} chars)"); } public void SaveCompressed(string characterName) { // Get highly compressed format AvatarDefinition avatarDef = avatar.GetAvatarDefinition(true); string compressedString = avatarDef.ToCompressedString("|"); string filePath = Path.Combine(savePath, $"{characterName}_compressed.txt"); File.WriteAllText(filePath, compressedString); Debug.Log($"Compressed save (size: {compressedString.Length * 2} bytes)"); } public void LoadCharacter(string characterName) { // Load from recipe string string filePath = Path.Combine(savePath, $"{characterName}.txt"); if (File.Exists(filePath)) { string recipeString = File.ReadAllText(filePath); avatar.LoadFromRecipeString(recipeString); Debug.Log($"Character loaded from {filePath}"); } else { Debug.LogError($"Character file not found: {filePath}"); } } public void LoadFromAvatarDefinition(string characterName) { string filePath = Path.Combine(savePath, $"{characterName}_def.txt"); if (File.Exists(filePath)) { string avatarDefString = File.ReadAllText(filePath); avatar.LoadAvatarDefinition(avatarDefString); avatar.BuildCharacter(false); // Don't restore old DNA Debug.Log($"Avatar definition loaded"); } } public void LoadCompressed(string characterName) { string filePath = Path.Combine(savePath, $"{characterName}_compressed.txt"); if (File.Exists(filePath)) { string compressedString = File.ReadAllText(filePath); AvatarDefinition avatarDef = AvatarDefinition.FromCompressedString(compressedString, '|'); avatar.LoadAvatarDefinition(avatarDef); avatar.BuildCharacter(false); Debug.Log("Compressed avatar loaded"); } } } ``` -------------------------------- ### LoadInstance Method for UMADna Source: https://github.com/umasteeringgroup/uma/blob/master/UMAProject/Assets/UMA/Core/Editor/Scripts/Templates/UmaDna_Template.cs.txt Loads a UMADnaBase instance from a given string data. This method is auto-generated and relies on external fragments for its core logic. Do not modify this code directly. ```csharp namespace UMA { public abstract partial class UMADna { public static UMADnaBase LoadInstance(System.Type dnaType, System.String data) { // UMA Auto genered code, DO NOT MODIFY!!! // All changes to this file will be destroyed without warning or confirmation! // Use double {{ to escape a single curly bracket // // template junk executed per UMADna derived sub class, the accumulated content is available through the {{0:ID}} tag // //#TEMPLATE Load UmaDna_Load_Fragment.cs.txt return null; } } } ``` -------------------------------- ### C# Character Event Handling with DynamicCharacterAvatar Source: https://context7.com/umasteeringgroup/uma/llms.txt This snippet demonstrates how to subscribe to and handle various UMA character events using the DynamicCharacterAvatar component in Unity. It covers subscribing to events like CharacterCreated, CharacterUpdated, CharacterDestroyed, CharacterDnaUpdated, RecipeUpdated, WardrobeAdded, and WardrobeRemoved. The code also shows how to access character data such as renderers, meshes, and skeletons, and includes proper cleanup of listeners in OnDestroy. Dependencies include the UMA and UMA.CharacterSystem namespaces. ```csharp using UMA; using UMA.CharacterSystem; using UnityEngine; public class CharacterEvents : MonoBehaviour { public DynamicCharacterAvatar avatar; void Start() { // Subscribe to all major character events avatar.CharacterCreated.AddListener(OnCharacterCreated); avatar.CharacterUpdated.AddListener(OnCharacterUpdated); avatar.CharacterDestroyed.AddListener(OnCharacterDestroyed); avatar.CharacterDnaUpdated.AddListener(OnCharacterDnaUpdated); avatar.RecipeUpdated.AddListener(OnRecipeUpdated); avatar.WardrobeAdded.AddListener(OnWardrobeAdded); avatar.WardrobeRemoved.AddListener(OnWardrobeRemoved); } void OnCharacterCreated(UMAData umaData) { Debug.Log($"Character created! Renderers: {umaData.rendererCount}"); // Access character mesh data if (umaData.rendererCount > 0) { SkinnedMeshRenderer renderer = umaData.GetRenderer(0); Mesh mesh = renderer.sharedMesh; Debug.Log($"Mesh vertices: {mesh.vertexCount}"); } // Access skeleton Transform[] bones = umaData.skeleton.bones; Debug.Log($"Skeleton bones: {bones.Length}"); } void OnCharacterUpdated(UMAData umaData) { Debug.Log("Character updated (rebuild completed)"); } void OnCharacterDestroyed(UMAData umaData) { Debug.Log("Character destroyed"); } void OnCharacterDnaUpdated(UMAData umaData) { Debug.Log("Character DNA updated"); } void OnRecipeUpdated(UMAData umaData) { Debug.Log("Recipe updated (before generation)"); } void OnWardrobeAdded(UMAData umaData, UMATextRecipe recipe) { Debug.Log($"Wardrobe added: {recipe.name}"); } void OnWardrobeRemoved(UMAData umaData, UMATextRecipe recipe) { Debug.Log($"Wardrobe removed: {recipe.name}"); } void OnDestroy() { // Clean up event listeners if (avatar != null) { avatar.CharacterCreated.RemoveListener(OnCharacterCreated); avatar.CharacterUpdated.RemoveListener(OnCharacterUpdated); avatar.CharacterDestroyed.RemoveListener(OnCharacterDestroyed); avatar.CharacterDnaUpdated.RemoveListener(OnCharacterDnaUpdated); avatar.RecipeUpdated.RemoveListener(OnRecipeUpdated); avatar.WardrobeAdded.RemoveListener(OnWardrobeAdded); avatar.WardrobeRemoved.RemoveListener(OnWardrobeRemoved); } } } ``` -------------------------------- ### Add Slot with Overlay to UMA Character - C# Source: https://context7.com/umasteeringgroup/uma/llms.txt This C# function demonstrates how to add a new slot with an overlay to a UMA character. It accesses UMA data, retrieves slot and overlay assets from the indexer, creates instances, sets overlay color, adds the overlay to the slot, adds the slot to the character's recipe, and finally rebuilds the character. ```csharp using UMA; using UMA.CharacterSystem; using UnityEngine; using System.Collections.Generic; public class SlotOverlayController : MonoBehaviour { public DynamicCharacterAvatar avatar; public void AddSlotWithOverlay() { // Access UMA data and recipe UMAData umaData = avatar.umaData; UMAData.UMARecipe recipe = umaData.umaRecipe; // Get slot asset from library UMAAssetIndexer indexer = UMAAssetIndexer.Instance; SlotDataAsset slotAsset = indexer.GetAsset("FemaleHair01"); if (slotAsset != null) { // Create slot instance SlotData slotData = new SlotData(slotAsset); // Get overlay asset OverlayDataAsset overlayAsset = indexer.GetAsset("FemaleHair01"); if (overlayAsset != null) { // Create overlay instance OverlayData overlay = new OverlayData(overlayAsset); // Set overlay color overlay.color = new Color(0.8f, 0.2f, 0.1f); // Add overlay to slot slotData.AddOverlay(overlay); } // Add slot to recipe recipe.SetSlot(slotData); // Rebuild character avatar.BuildCharacter(); } } public void ModifySlotOverlayColor(string slotName, Color newColor) { UMAData.UMARecipe recipe = avatar.umaData.umaRecipe; // Find slot by name SlotData slot = recipe.GetSlot(slotName); if (slot != null && slot.GetOverlayList().Count > 0) { // Modify first overlay color OverlayData overlay = slot.GetOverlay(0); overlay.color = newColor; // Rebuild to apply changes avatar.BuildCharacter(); } } public void AddAdditionalOverlayToSlot(string slotName) { UMAAssetIndexer indexer = UMAAssetIndexer.Instance; UMAData.UMARecipe recipe = avatar.umaData.umaRecipe; SlotData slot = recipe.GetSlot(slotName); if (slot != null) { // Add tattoo or decal overlay on top of existing overlays OverlayDataAsset tattooOverlay = indexer.GetAsset("FemaleTattoo01"); if (tattooOverlay != null) { OverlayData overlay = new OverlayData(tattooOverlay); slot.AddOverlay(overlay); avatar.BuildCharacter(); } } } public void ListAllSlots() { UMAData.UMARecipe recipe = avatar.umaData.umaRecipe; SlotData[] slots = recipe.GetAllSlots(); foreach (SlotData slot in slots) { Debug.Log($"Slot: {slot.slotName}, Overlays: {slot.GetOverlayList().Count}"); foreach (OverlayData overlay in slot.GetOverlayList()) { Debug.Log($" Overlay: {overlay.overlayName}, Color: {overlay.color}"); } } } } ``` -------------------------------- ### Manage Wardrobe Items in UMA Character Source: https://context7.com/umasteeringgroup/uma/llms.txt These C# methods allow for adding, removing, and updating wardrobe items on a UMA DynamicCharacterAvatar. It includes functions to set individual slots, clear slots, apply full wardrobe collections, add multiple items from the global library, retrieve current wardrobe items, and change item colors. Dependencies include UMA.CharacterSystem and UnityEngine. ```csharp using UMA; using UMA.CharacterSystem; using UnityEngine; public class WardrobeManager : MonoBehaviour { public DynamicCharacterAvatar avatar; public void SetWardrobeItem(UMAWardrobeRecipe recipe) { // Add or replace wardrobe item in its slot avatar.SetSlot(recipe); avatar.BuildCharacter(); } public void RemoveWardrobeItem(string slotName) { // Remove item from specific slot (e.g., "Chest", "Legs", "Feet") avatar.ClearSlot(slotName); avatar.BuildCharacter(); } public void AddWardrobeCollection(UMAWardrobeCollection collection) { // Apply entire wardrobe collection (outfit) avatar.SetWardrobeCollection(collection); avatar.BuildCharacter(); } public void AddMultipleItems() { // Load wardrobe recipes from Global Library UMAAssetIndexer indexer = UMAAssetIndexer.Instance; // Get wardrobe recipe by name UMAWardrobeRecipe shirt = indexer.GetAsset("MaleShirt01"); UMAWardrobeRecipe pants = indexer.GetAsset("MalePants01"); UMAWardrobeRecipe shoes = indexer.GetAsset("MaleShoes01"); if (shirt != null) avatar.SetSlot(shirt); if (pants != null) avatar.SetSlot(pants); if (shoes != null) avatar.SetSlot(shoes); // Build once after all changes avatar.BuildCharacter(); } public void GetCurrentWardrobe() { // Retrieve all active wardrobe recipes Dictionary wardrobeRecipes = avatar.WardrobeRecipes; foreach (var kvp in wardrobeRecipes) { Debug.Log($"Slot: {kvp.Key}, Recipe: {kvp.Value.name}"); } } public void ChangeWardrobeColor(string colorName, Color newColor) { // Change color of wardrobe items avatar.SetColor(colorName, newColor); avatar.BuildCharacter(); } } ``` -------------------------------- ### SaveInstance Method for UMADna Source: https://github.com/umasteeringgroup/uma/blob/master/UMAProject/Assets/UMA/Core/Editor/Scripts/Templates/UmaDna_Template.cs.txt Saves a UMADnaBase instance to a string representation. This method is auto-generated and its implementation is determined by external template fragments. Direct modification is not recommended. ```csharp namespace UMA { public abstract partial class UMADna { public static System.String SaveInstance(UMADnaBase instance) { System.Type dnaType = instance.GetType(); // UMA Auto genered code, DO NOT MODIFY!!! // All changes to this file will be destroyed without warning or confirmation! // Use double {{ to escape a single curly bracket // // template junk executed per UMADna derived sub class, the accumulated content is available through the {{0:ID}} tag // //#TEMPLATE Save UmaDna_Save_Fragment.cs.txt return null; } } } ``` -------------------------------- ### Change Character Race in UMA Source: https://context7.com/umasteeringgroup/uma/llms.txt These C# methods demonstrate how to change the race of a UMA DynamicCharacterAvatar with various options. Functions include changing to male or female races while preserving wardrobe and body colors, or completely resetting the character. It also shows how to retrieve a list of all available races from the global library. Dependencies include UMA.CharacterSystem and UnityEngine. ```csharp using UMA; using UMA.CharacterSystem; using UnityEngine; public class RaceChanger : MonoBehaviour { public DynamicCharacterAvatar avatar; public void ChangeToMale() { // Change race while preserving wardrobe and colors avatar.ChangeRace("HumanMale", DynamicCharacterAvatar.ChangeRaceOptions.keepWardrobe | DynamicCharacterAvatar.ChangeRaceOptions.keepBodyColors ); } public void ChangeToFemale() { // Change race with custom options avatar.ChangeRace("HumanFemale", DynamicCharacterAvatar.ChangeRaceOptions.keepWardrobe | DynamicCharacterAvatar.ChangeRaceOptions.keepBodyColors | DynamicCharacterAvatar.ChangeRaceOptions.keepDNA ); } public void ChangeRaceWithFullReset() { // Change race without keeping any existing data avatar.ChangeRace("HumanMale", DynamicCharacterAvatar.ChangeRaceOptions.none); } public void GetAvailableRaces() { // Retrieve all races from the global library UMAAssetIndexer indexer = UMAAssetIndexer.Instance; var races = indexer.GetAllAssets(); foreach (RaceData race in races) { Debug.Log($"Available Race: {race.raceName}"); } } } ``` -------------------------------- ### Modify Character DNA at Runtime (C#) Source: https://context7.com/umasteeringgroup/uma/llms.txt This script provides functionalities to modify a character's DNA values at runtime using the UMA framework. It includes methods to set individual DNA values, apply multiple DNA changes in batch, retrieve current DNA, and randomize all DNA values for the character's race. It requires a reference to a DynamicCharacterAvatar component. ```csharp using UMA; using UMA.CharacterSystem; using UnityEngine; public class DNAController : MonoBehaviour { public DynamicCharacterAvatar avatar; public void SetDNAValue(string dnaName, float value) { // Set individual DNA value and rebuild character avatar.SetDNA(dnaName, value); avatar.BuildCharacter(); } public void SetMultipleDNAValues() { // Create DNA dictionary for batch updates Dictionary dnaValues = new Dictionary { { "height", 0.85f }, { "headSize", 1.2f }, { "upperWeight", 0.6f }, { "lowerWeight", 0.7f }, { "armLength", 0.9f }, { "legLength", 1.05f } }; // Apply all DNA values at once foreach (var kvp in dnaValues) { avatar.SetDNA(kvp.Key, kvp.Value); } // Rebuild character once after all changes avatar.BuildCharacter(); } public void GetCurrentDNA() { // Retrieve current DNA values if (avatar.umaData != null && avatar.umaData.umaRecipe != null) { foreach (var dna in avatar.umaData.umaRecipe.GetAllDna()) { Debug.Log($"DNA: {dna.GetType().Name}"); } } } public void RandomizeDNA() { // Get all DNA names for the current race List dnaNames = avatar.activeRace.data.GetDNANames(); // Randomize each DNA value foreach (string dnaName in dnaNames) { float randomValue = Random.Range(0f, 1f); avatar.SetDNA(dnaName, randomValue); } avatar.BuildCharacter(); } } ``` -------------------------------- ### UMA C# Class Generation for DNA Handling Source: https://github.com/umasteeringgroup/uma/blob/master/UMAProject/Assets/UMA/Core/Editor/Scripts/Templates/UmaDnaChild_Template.cs.txt This C# code defines the structure for UMA DNA objects, including properties for values, names, and methods for loading and saving instances. It also includes a nested class for byte serialization. ```csharp // UMA Auto genered code, DO NOT MODIFY!!! // All changes to this file will be destroyed without warning or confirmation! // Use double {{ to escape a single curly bracket // // template junk executed per dna Field , the accumulated content is available through the {{0:ID}} tag // //#TEMPLATE GetValues UmaDnaChild_GetIndex_Fragment.cs.txt //#TEMPLATE SetValues UmaDnaChild_SetIndex_Fragment.cs.txt //#TEMPLATE GetValue UmaDnaChild_GetValue_Fragment.cs.txt //#TEMPLATE SetValue UmaDnaChild_SetValue_Fragment.cs.txt //#TEMPLATE GetNames UmaDnaChild_GetNames_Fragment.cs.txt // // Byte Serialization Handling // //#TEMPLATE Byte_Fields UmaDnaChild_Byte_Fields_Fragment.cs.txt //#TEMPLATE Byte_ToDna UmaDnaChild_Byte_ToDna_Fragment.cs.txt //#TEMPLATE Byte_FromDna UmaDnaChild_Byte_FromDna_Fragment.cs.txt // namespace UMA { public partial class {0:ClassName} { public override int Count { get { return {0:DnaEntries}; } } public override float[] Values { get { return new float[] { {0:GetValues} }; } set { {0:SetValues} } } public override float GetValue(int idx) { switch(idx) { {0:GetValue} } throw new System.ArgumentOutOfRangeException(); } public override void SetValue(int idx, float value) { switch(idx) { {0:SetValue} } throw new System.ArgumentOutOfRangeException(); } public static string[] GetNames() { return new string[] { {0:GetNames} }; } public override string[] Names { get { return GetNames(); } } public static {0:ClassName} LoadInstance(string data) { return UnityEngine.JsonUtility.FromJson<{0:ClassName}_Byte>(data).ToDna(); } public static string SaveInstance({0:ClassName} instance) { return UnityEngine.JsonUtility.ToJson({0:ClassName}_Byte.FromDna(instance)); } } [System.Serializable] public class {0:ClassName}_Byte { {0:Byte_Fields} public {0:ClassName} ToDna() { var res = new {0:ClassName}(); {0:Byte_ToDna} return res; } public static {0:ClassName}_Byte FromDna({0:ClassName} dna) { var res = new {0:ClassName}_Byte(); {0:Byte_FromDna} return res; } } } ``` -------------------------------- ### GetTypes Method for UMADna Source: https://github.com/umasteeringgroup/uma/blob/master/UMAProject/Assets/UMA/Core/Editor/Scripts/Templates/UmaDna_Template.cs.txt Returns an array of System.Type objects representing all available UMA DNA types. This is an auto-generated method and its implementation is driven by external template fragments. ```csharp namespace UMA { public abstract partial class UMADna { public static System.Type[] GetTypes() { return new System.Type[] { // UMA Auto genered code, DO NOT MODIFY!!! // All changes to this file will be destroyed without warning or confirmation! // Use double {{ to escape a single curly bracket // // template junk executed per UMADna derived sub class, the accumulated content is available through the {{0:ID}} tag // //#TEMPLATE GetTypes UmaDna_GetTypes_Fragment.cs.txt }; } } } ``` -------------------------------- ### GetType Method for UMADna Source: https://github.com/umasteeringgroup/uma/blob/master/UMAProject/Assets/UMA/Core/Editor/Scripts/Templates/UmaDna_Template.cs.txt Retrieves a System.Type object based on a provided class name string. This method is auto-generated and should not be edited. Its functionality is determined by external template fragments. ```csharp namespace UMA { public abstract partial class UMADna { public static System.Type GetType(System.String className) { // UMA Auto genered code, DO NOT MODIFY!!! // All changes to this file will be destroyed without warning or confirmation! // Use double {{ to escape a single curly bracket // // template junk executed per UMADna derived sub class, the accumulated content is available through the {{0:ID}} tag // //#TEMPLATE GetType UmaDna_GetType_Fragment.cs.txt return null; } } } ``` -------------------------------- ### GetNames Method for UMADna Source: https://github.com/umasteeringgroup/uma/blob/master/UMAProject/Assets/UMA/Core/Editor/Scripts/Templates/UmaDna_Template.cs.txt Retrieves an array of names associated with a specific UMA DNA type. This method is part of the auto-generated code and should not be modified directly. It relies on external fragments for its implementation. ```csharp namespace UMA { public abstract partial class UMADna { public static string[] GetNames(System.Type dnaType) { // UMA Auto genered code, DO NOT MODIFY!!! // All changes to this file will be destroyed without warning or confirmation! // Use double {{ to escape a single curly bracket // // template junk executed per UMADna derived sub class, the accumulated content is available through the {{0:ID}} tag // //#TEMPLATE GetNames UmaDna_GetNames_Fragment.cs.txt return new string[0]; } } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.