first commit

This commit is contained in:
lethanhsonvsp
2025-11-17 15:16:36 +07:00
commit a40d0921eb
17012 changed files with 2652386 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
using UnityEngine;
using UnityEngine.Animations.Rigging;
using UnityEngine.Playables;
namespace DocCodeExamples
{
/// <summary>
/// Custom evaluator that manually evaluates the PlayableGraph in LateUpdate.
/// </summary>
#region custom-playable-graph-evaluator
[RequireComponent(typeof(RigBuilder))]
public class CustomPlayableGraphEvaluator : MonoBehaviour
{
private RigBuilder m_RigBuilder;
private PlayableGraph m_PlayableGraph;
void OnEnable()
{
m_RigBuilder = GetComponent<RigBuilder>();
m_PlayableGraph = PlayableGraph.Create();
m_PlayableGraph.SetTimeUpdateMode(DirectorUpdateMode.Manual);
m_RigBuilder.Build(m_PlayableGraph);
}
void OnDisable()
{
if (m_PlayableGraph.IsValid())
m_PlayableGraph.Destroy();
}
void LateUpdate()
{
m_RigBuilder.SyncLayers();
m_PlayableGraph.Evaluate(Time.deltaTime);
}
}
#endregion
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a2411ac2c7bbd4f58aaae3e6cefda2aa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,35 @@
using UnityEngine;
using UnityEngine.Animations.Rigging;
using UnityEngine.Playables;
namespace DocCodeExamples
{
/// <summary>
/// Custom Evaluator that manually evaluates the RigBuilder in LateUpdate.
/// </summary>
#region custom-rig-builder-evaluator
[RequireComponent(typeof(RigBuilder))]
public class CustomRigBuilderEvaluator : MonoBehaviour
{
private RigBuilder m_RigBuilder;
void OnEnable()
{
m_RigBuilder = GetComponent<RigBuilder>();
// Disable the RigBuilder and set its PlayableGraph to manual update mode
// to let the script evaluate it instead.
m_RigBuilder.enabled = false;
if (m_RigBuilder.Build())
{
m_RigBuilder.graph.SetTimeUpdateMode(DirectorUpdateMode.Manual);
}
}
void LateUpdate()
{
m_RigBuilder.Evaluate(Time.deltaTime);
}
}
#endregion
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: dc9f69976d6143e489b841bec6ac5cfd
timeCreated: 1636580728

View File

@@ -0,0 +1,16 @@
{
"name": "Unity.Animation.Rigging.DocCodeExamples",
"rootNamespace": "",
"references": [
"Unity.Animation.Rigging"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": true,
"precompiledReferences": [],
"autoReferenced": false,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c2a5362f5f25b455f8f4eeea25441772
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: