Thank you, then I will add a method and spawn those instances manually.
woncomp

- 22 авг 2015
- Регистрация: 21 авг 2015
I noticed that all the SkeletonRenderer instance sharing a single material instance from 'rendererObject'.
Why not instansiate a clone for each SkeletonRenderer object?
In this situation I cant control material parameters individually to each spine animation object.(I wrote a custom shader)I made some modification to the source code and achieved my purpose, but I cannot be sure if it is fine to do like this.
If my modification crashed something please tell me.// SkeletonRenderer.cs public class SkeletonRenderer : MonoBehaviour { //... Code private Dictionary<Material, Material> _materialInstances = new Dictionary<Material, Material>(); //... Code public virtual void OnDestroy () { //... Code foreach (var keyValuePair in _materialInstances) { if (Application.isPlaying) Destroy(keyValuePair.Value); else DestroyImmediate(keyValuePair.Value); } _materialInstances.Clear(); } //... Code public virtual void LateUpdate () { //... Code #if !SPINE_TK2D Material material = (Material)((AtlasRegion)rendererObject).page.rendererObject; #else Material material = (rendererObject.GetType() == typeof(Material)) ? (Material)rendererObject : (Material)((AtlasRegion)rendererObject).page.rendererObject; #endif { var keyMaterial = material; if (_materialInstances.ContainsKey(keyMaterial)) { material = _materialInstances[keyMaterial]; } else { material = Instantiate(material); material.hideFlags = HideFlags.DontSave; _materialInstances[keyMaterial] = material; } } //... Code } }
- Изменено
[1]
Inside SkeletonAnimator.csAround line 120:
animationTable[GetAnimationClipNameHashCode(info.clip)].Mix(skeleton, Mathf.Max(0, time - deltaTime), time, stateInfo.loop, null, weight);
All these lastTime were wrong, you made it Mathf.Max(0, time-deltaTime), that is assuming the speed scale of animation is 1, if anyone change the animator state speed in editor or entire animator speed in runtime, the lastTime parameter then calculated a wrong value. It is working fine because spine-csharp runtime didn't actually using the 'lastTime' parameter to interpolate timeline values. But it's still a mistake. You probably want to do something with this.
[2]
SkeletonUtilityBone.cszPosition has no use or something? I don't understand.
If you have the time please add some tooltips to these fields, that could be more friendly to newbies.Thank you for doing so much effort to spine unity3d runtime, provided us a powerful, easy to use runtime, with a lot of cool features (like foot constraint, ghosting), and great editor, and thank you for those tutorial videos, that really helped me a lot.