99/// player switching back, or multiple remote players sharing the same model — skips
1010/// the expensive bake/capture work and copies from cache instead.
1111///
12- /// Cache key: <c>Animator.avatar.GetInstanceID ()</c> — unique per loaded Avatar asset,
12+ /// Cache key: <c>Animator.avatar.GetEntityId ()</c> — unique per loaded Avatar asset,
1313/// stable across instances of the same model within a session.
1414///
1515/// Subsystems store their data in typed slots on <see cref="Entry"/>. A null slot means
@@ -124,21 +124,21 @@ public class BonePresenceData
124124 // Storage
125125 // ────────────────────────────────────────────────────────────
126126
127- private static readonly Dictionary < int , Entry > _cache = new Dictionary < int , Entry > ( 16 ) ;
127+ private static readonly Dictionary < EntityId , Entry > _cache = new Dictionary < EntityId , Entry > ( 16 ) ;
128128
129129 /// <summary>
130130 /// Gets the cache key for an animator's avatar asset.
131- /// Returns 0 if the avatar is null (caller should skip caching).
131+ /// Returns <see cref="EntityId.None"/> if the avatar is null (caller should skip caching).
132132 /// </summary>
133- public static int GetKey ( Animator animator )
133+ public static EntityId GetKey ( Animator animator )
134134 {
135- return animator != null && animator . avatar != null ? animator . avatar . GetInstanceID ( ) : 0 ;
135+ return animator != null && animator . avatar != null ? animator . avatar . GetEntityId ( ) : EntityId . None ;
136136 }
137137
138138 /// <summary>
139139 /// Gets or creates the cache entry for the given avatar asset key.
140140 /// </summary>
141- public static Entry GetOrCreate ( int key )
141+ public static Entry GetOrCreate ( EntityId key )
142142 {
143143 if ( ! _cache . TryGetValue ( key , out Entry entry ) )
144144 {
@@ -151,15 +151,15 @@ public static Entry GetOrCreate(int key)
151151 /// <summary>
152152 /// Tries to get an existing cache entry. Returns false if not cached.
153153 /// </summary>
154- public static bool TryGet ( int key , out Entry entry )
154+ public static bool TryGet ( EntityId key , out Entry entry )
155155 {
156156 return _cache . TryGetValue ( key , out entry ) ;
157157 }
158158
159159 /// <summary>
160160 /// Removes a specific avatar's cache entry (e.g., when its bundle is unloaded).
161161 /// </summary>
162- public static void Remove ( int key )
162+ public static void Remove ( EntityId key )
163163 {
164164 _cache . Remove ( key ) ;
165165 }
@@ -190,10 +190,10 @@ public static void Clear()
190190 /// </summary>
191191 public static void RecordPosesCached ( Basis . Scripts . Common . BasisTransformMapping mapping , Animator animator )
192192 {
193- int key = GetKey ( animator ) ;
193+ EntityId key = GetKey ( animator ) ;
194194
195195 // Cache hit: restore from arrays
196- if ( key != 0 && TryGet ( key , out var entry ) && entry . TposeLocal != null && entry . TposeFromRoot != null && entry . TposeWorld != null )
196+ if ( key != EntityId . None && TryGet ( key , out var entry ) && entry . TposeLocal != null && entry . TposeFromRoot != null && entry . TposeWorld != null )
197197 {
198198 RestorePosesFromCache ( mapping , animator , entry ) ;
199199 return ;
@@ -203,13 +203,13 @@ public static void RecordPosesCached(Basis.Scripts.Common.BasisTransformMapping
203203 mapping . RecordPoses ( animator ) ;
204204
205205 // Store for next time
206- if ( key != 0 )
206+ if ( key != EntityId . None )
207207 {
208208 StorePosesToCache ( key , mapping ) ;
209209 }
210210 }
211211
212- private static void StorePosesToCache ( int key , Basis . Scripts . Common . BasisTransformMapping mapping )
212+ private static void StorePosesToCache ( EntityId key , Basis . Scripts . Common . BasisTransformMapping mapping )
213213 {
214214 var entry = GetOrCreate ( key ) ;
215215 int boneCount = ( int ) HumanBodyBones . LastBone ;
0 commit comments