tony020409

When I GetRepackedSkin,i had a error.
Graphics.CopyTexture could not find destination D3D11 texture object. Maybe it is a RenderTexture that is not created yet?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Spine.Unity;
using Spine.Unity.AttachmentTools;

public class TestSpine : MonoBehaviour
{
public SkeletonAnimation blackbear;
public SkeletonAnimation greenbear;

private Material _runtimeMaterial;
private Texture2D _runtimeAtlas;
void Start()
{
StartCoroutine(ChangeSkin());
}

IEnumerator ChangeSkin()
{
yield return new WaitForEndOfFrame();
greenbear.gameObject.SetActive(false);
yield return new WaitForSeconds(3f);

Spine.Skin SkinDefault = blackbear.skeleton.Data.FindSkin("_Default");
Spine.Skin Skinhead = greenbear.skeleton.Data.FindSkin("hat");
Spine.Skin skinMix = new Spine.Skin("Mix");
skinMix.CopySkin(SkinDefault);
skinMix.AddSkin(Skinhead);

blackbear.skeleton.SetSkin(skinMix);
blackbear.skeleton.UpdateCache();
blackbear.skeleton.SetSlotsToSetupPose();

if (null != _runtimeMaterial)
{
Destroy(_runtimeMaterial);
}

if (null != _runtimeAtlas)
{
Destroy(_runtimeAtlas);
}

Spine.Skin repackedSkin = skinMix.GetRepackedSkin(
"RepackedSkin",
blackbear.skeletonDataAsset.atlasAssets[0].PrimaryMaterial,
out _runtimeMaterial,
out _runtimeAtlas
);

skinMix.Clear();

blackbear.skeleton.SetSkin(repackedSkin);
blackbear.skeleton.UpdateCache();
blackbear.skeleton.SetSlotsToSetupPose();

Destroy(greenbear.gameObject);
}
}
tony020409
  • Postovi: 7

Harald

We are sorry for the troubles! Which version of the spine-unity runtime (name of the unitypackage, also listed in Assets/Spine/version.txt) are you using?

Could you perhaps send us a minimal Unity project that still demonstrates this error? You can send it as a zip package to contact@esotericsoftware.com, briefly mentioning this forum thread URL so that we know the context.
Avatar
Harald

Harri
  • Postovi: 4088

tony020409

I have finished processing, set the mesh type to FullRect. :D
tony020409
  • Postovi: 7

Harald

Glad to hear you've figured it out, thanks for letting us know.
Avatar
Harald

Harri
  • Postovi: 4088


Natrag na Unity