10using System.Collections;
11using System.Collections.Generic;
17 public struct Hash : IEnumerable, IEquatable<Hash> {
25 int code = t ==
null ? 0x2692d0f9 : t.GetHashCode();
26 _hash ^= code + 0x3e3779b9 + (_hash << 6) + (_hash >> 2);
30 for (
int i = 0; i < sequence.Count; i++) {
43 private static List<Behaviour> _behaviourCache =
new List<Behaviour>();
47 int childCount = root.childCount;
48 for (
int i = 0; i < childCount; i++) {
52 root.GetComponents(_behaviourCache);
53 for (
int i = 0; i < _behaviourCache.Count; i++) {
54 var behaviour = _behaviourCache[i];
58 if (behaviour !=
null) {
59 hash.Add(behaviour.enabled);
74 var hash =
new Hash() {
76 transform.gameObject.activeSelf,
77 transform.localPosition,
78 transform.localRotation,
82 if (transform is RectTransform) {
83 RectTransform rectTransform = transform as RectTransform;
84 hash.Add(rectTransform.rect);
91 throw new NotImplementedException();
98 public override bool Equals(
object obj) {
103 return hash._hash == _hash;
107 return _hash == other._hash;
110 public static implicit
operator Hash(
int hash) {
111 return new Hash(hash);
114 public static implicit
operator int(
Hash hash) {
static Hash GetHierarchyHash(Transform root)
static Hash GetDataHash(Transform transform)
Returns a hash of the Transform in addition to it's data. Changing either the position,...
void AddRange< T >(List< T > sequence)
override bool Equals(object obj)
IEnumerator GetEnumerator()
override int GetHashCode()