gunspike

I destroy the object by writing the following script. What method should I use to reload?

Animation calls are made using the animation taster tool script of the Spine runtime.

After the animation occurred, the object was deleted as shown in the script below.
After that, I thought it would reload if I setempty in the animation, but it doesn't work.

reload?
How do I put an object in the spine back to setempty state? Let's find it with a script search on Google. Any hints on writing the code?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Spine.Unity;

public class SpineAnimationEndDestory : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
var skeletonAnimation = GetComponentInChildren<SkeletonAnimation>(true);
skeletonAnimation.AnimationState.Complete += (e) =>
{
Destroy(gameObject);
};
}

// Update is called once per frame
void Update()
{

}
}
gunspike
  • Messaggi: 134

Harald

If you call Destroy(gameObject) you destroy the whole GameObject that this script component is attached to, including all components and all child GameObjects. Afterwards there is nothing left to reset.

What are you trying to achieve? If you really want to destroy the complete GameObject including everything, you would use another GameObject that creates and destroys things, e.g. instantiate and destroy a prefab. Just search the web on how to use Prefabs with Unity.
Avatar utente
Harald

Harri
  • Messaggi: 4343

gunspike

Oh I see.
Can I proceed after prepping the object?

Thank you very much for your reply.
gunspike
  • Messaggi: 134

Harald

gunspike ha scritto:Can I proceed after prepping the object?
I'm not sure what you are trying to achieve, could you please describe to us what behaviour you would like to see at your skeletons?
Avatar utente
Harald

Harri
  • Messaggi: 4343

gunspike

sorry. The meaning of content delivery was conveyed differently due to Google Translator. I understand that it is used as a prepep. thank you always
gunspike
  • Messaggi: 134

Harald

No worries, we unfortunately also need to rely on machine translation for Chinese requests, so we encounter similar problems regularly. :)
Avatar utente
Harald

Harri
  • Messaggi: 4343


Torna a Unity