Skip to content

Commit bc7b589

Browse files
committed
Generate hash automatically if not yet set
1 parent 8709e23 commit bc7b589

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

Runtime/DataStructures/AnimatorParameter.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,16 @@ public struct AnimatorParameter
1616
/// <summary>
1717
/// The hash id of the animation parameter.
1818
/// </summary>
19-
public int hash => _hash;
19+
public int hash
20+
{
21+
get
22+
{
23+
if (_hash == 0) {
24+
_hash = Animator.StringToHash(_name);
25+
}
26+
return _hash;
27+
}
28+
}
2029

2130
[SerializeField]
2231
[Tooltip("The name of the animation parameter.")]
@@ -44,15 +53,6 @@ public AnimatorParameter(string name)
4453
_hash = Animator.StringToHash(name);
4554
}
4655

47-
/// <summary>
48-
/// Generates a new hash for the parameter using the current name.
49-
/// </summary>
50-
public int GenerateHash()
51-
{
52-
_hash = Animator.StringToHash(_name);
53-
return _hash;
54-
}
55-
5656
public static implicit operator AnimatorParameter(string name) => new AnimatorParameter(name);
5757

5858
}

0 commit comments

Comments
 (0)