forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHack.cs
More file actions
35 lines (32 loc) · 1.03 KB
/
Copy pathHack.cs
File metadata and controls
35 lines (32 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#if !UNITY_DISABLE_MANAGED_COMPONENTS
using Unity.Entities;
using UnityEngine;
namespace Samples.HelloNetcode
{
public class HackComponent : IComponentData
{
public AnimationClip[] Clip;
}
/// <summary>
/// This is a necessary hack to make the ClientSideAnimation.unity scene work in standalone in the case
/// where this scene is the only one added to the build settings.
///
/// It fixes an issue during baking by forcing a reference the clips that
/// is necessary for the animator state machine to work.
/// </summary>
public class Hack : MonoBehaviour
{
public GameObject Reference;
class Baker : Baker<Hack>
{
public override void Bake(Hack authoring)
{
AddComponentObject(GetEntity(TransformUsageFlags.Dynamic), new HackComponent
{
Clip = authoring.Reference.GetComponent<Animator>().runtimeAnimatorController.animationClips,
});
}
}
}
}
#endif