- Uređeno
Ghosting effect at runtime
Hi guys,
Spine had this ghosting effect, but I haven't been able to get it to work recently.
Is there a way to enable\ disable it during runtime?
Thanks
I've been testing it out recently and its been working great.
You can turn the effect on and off by enabling/disabling the "Skeleton Ghost" component through a script (aka skeletonGhost.enabled = true)
Jamez0r wroteI've been testing it out recently and its been working great.
You can turn the effect on and off by enabling/disabling the "Skeleton Ghost" component through a script (aka skeletonGhost.enabled = true)
Thank you for the confirmation. I guess I'm doing something wrong then.. are you by any chance keyframing the "ghosting" into your animation?.. That's what I've been doing. Maybe that's why it's not working for me? :scared:
IndieDoroid wroteThank you for the confirmation. I guess I'm doing something wrong then.. are you by any chance keyframing the "ghosting" into your animation?.. That's what I've been doing. Maybe that's why it's not working for me? :scared:
What do you mean by keyframing the ghosting? Are you triggering the ghosting by using an event?
I would start by just testing out the ghosting on its own:
1) Create a new scene, and make a new SkeletonAnimation (drag one of your SkeletonData files into the Scene)
2) Add component: "Skeleton Ghost"
3) Press Play, and then Ghost effect should appear (you can move around the SkeletonAnimation in the Scene view to see the ghost effect.
4) Disable / Enable the Skeleton Ghost component to verify that it turns on and off
If that works, then take it from there to figure out what might be going wrong with your original setup.
And just to be clear - the "Skeleton Ghost" is completely separate from the Ghosting "view" in Spine. Just want to make sure you weren't thinking they were related
@Jamez0r thanks very much for answering!
@IndieDoroid Please note that the SkeletonGhost
component is an example script and therefore contained in the Spine Examples
directory, in Spine Examples/Scripts/Sample Components/Ghost
to be precise. So if you have perhaps deleted the Spine Examples
directory entirely it will not be listed under Add Component
.
If you have added it successfully and ran into other problems, please let us know.
Jamez0r wroteIndieDoroid wroteThank you for the confirmation. I guess I'm doing something wrong then.. are you by any chance keyframing the "ghosting" into your animation?.. That's what I've been doing. Maybe that's why it's not working for me? :scared:
What do you mean by keyframing the ghosting? Are you triggering the ghosting by using an event?
I would start by just testing out the ghosting on its own:
1) Create a new scene, and make a new SkeletonAnimation (drag one of your SkeletonData files into the Scene)
2) Add component: "Skeleton Ghost"
3) Press Play, and then Ghost effect should appear (you can move around the SkeletonAnimation in the Scene view to see the ghost effect.
4) Disable / Enable the Skeleton Ghost component to verify that it turns on and offIf that works, then take it from there to figure out what might be going wrong with your original setup.
And just to be clear - the "Skeleton Ghost" is completely separate from the Ghosting "view" in Spine. Just want to make sure you weren't thinking they were related
Yea, I used the method from youtube where it was a spine event. Thanks for outlining the method you used.
Harald wrote@[obrisani korisnik] thanks very much for answering!
@IndieDoroid Please note that the
SkeletonGhost
component is an example script and therefore contained in theSpine Examples
directory, inSpine Examples/Scripts/Sample Components/Ghost
to be precise. So if you have perhaps deleted theSpine Examples
directory entirely it will not be listed underAdd Component
.If you have added it successfully and ran into other problems, please let us know.
@Harald Thanks for the tip. That would explain it. I usually don't install the example folders because it adds in a bunch of images\ files that clutter up my project view when selecting textures etc. Is there a reason it's not part of the default runtime scripts?
UPDATE
HI @Harald
Everything works great for the most part. But I seem to have a weird bug where I can't control the "ghostingEnabled" bool via argument.
public void Ghost(bool _ghostEnable)
Does not work for me. I'm not sure what I'm doing wrong. When I print it, I can see the bool is true, but via the inspector the bool isn't enabled. Current fix I have, is to use Update() to force the bool.. through another public bool. :wounded:
IndieDoroid wroteIs there a reason it's not part of the default runtime scripts?
The main border between example components and default runtime components is that you could use the existing runtime API yourself to achive the same goal as the example component, and that it's not necessarily the only, best or most flexible way to achive this goal. In other words, the example components provide a good solution for most cases but you might find a combination of components where they both work well in isolation, but not in combination. One example would be material management, e.g. each component holding references to two switchable materials. The required solution would need to switch between 2*2 materials and thus either know about the other component, or perform additional queries and tests at runtime, adding lots of unnecessary complexity or overhead.
So in short: When the perfect solution is unnecessary complex, we still want to supply you with a solution that covers 95% of the use cases as an example component. At these example components you should feel free to modify them according to your needs.
IndieDoroid wroteEverything works great for the most part. But I seem to have a weird bug where I can't control the "ghostingEnabled" bool via argument.
public void Ghost(bool _ghostEnable)
Does not work for me
Which method do you mean, I see no public method of this name?
Apart from that, you should be able to directly change the public bool SkeletonGhost.ghostingEnabled
here. An alternative would be to disable the SkeletonGhost
component, it also leads to the same end result.
Harald wroteIndieDoroid wroteIs there a reason it's not part of the default runtime scripts?
The main border between example components and default runtime components is that you could use the existing runtime API yourself to achive the same goal as the example component, and that it's not necessarily the only, best or most flexible way to achive this goal. In other words, the example components provide a good solution for most cases but you might find a combination of components where they both work well in isolation, but not in combination. One example would be material management, e.g. each component holding references to two switchable materials. The required solution would need to switch between 2*2 materials and thus either know about the other component, or perform additional queries and tests at runtime, adding lots of unnecessary complexity or overhead.
So in short: When the perfect solution is unnecessary complex, we still want to supply you with a solution that covers 95% of the use cases as an example component. At these example components you should feel free to modify them according to your needs.
IndieDoroid wroteEverything works great for the most part. But I seem to have a weird bug where I can't control the "ghostingEnabled" bool via argument.
public void Ghost(bool _ghostEnable)
Does not work for me
Which method do you mean, I see no public method of this name?
Apart from that, you should be able to directly change the public boolSkeletonGhost.ghostingEnabled
here. An alternative would be to disable theSkeletonGhost
component, it also leads to the same end result.
Thanks I'll give these a try!