通信画面のようなものを作っています。
I'm making a kind of communication screen.
Spineを使って素体の出し変えをしたいと思います。
I would like to use Spine to change the object.
最初はSpineには何も入っていません。
At first, there is nothing in Spine.
_SkeletonDataAsset = Resources.Load<SkeletonDataAsset>("Spine Examples/Spine Skeletons/Spineunitygirl/Doi_SkeletonData");
SpineCG2.GetComponent<SkeletonAnimation>().skeletonDataAsset = _SkeletonDataAsset;
通信が始まるとスクリプトにより右側に画像を出します。
(右側のSpineは毎回女の子とは限りません。)
When the communication starts, the script will show the image on the right side of the screen.
(The Spine on the right isn't necessarily a girl every time.)
SpineCG2.GetComponent<SkeletonAnimation>().skeletonDataAsset = null;
通信が終わるとSpineの画像を消したいと思っています。
ただし、このときゲームオブジェクトはactiveのままにしたいとおもっています。
I would like to delete the Spine image when the communication is over.
However, I would like to leave the game object active at this time.
簡略化したコードを書くとこちらです。
Here's a simplified version of the code
void Update()
{
if (Input.GetButtonDown("Fire1"))
{
_SkeletonDataAsset = Resources.Load<SkeletonDataAsset>("Spine Examples/Spine Skeletons/Spineunitygirl/Doi_SkeletonData");
SpineCG2.GetComponent<SkeletonAnimation>().skeletonDataAsset = _SkeletonDataAsset;
SpineCG2.GetComponent<SkeletonAnimation>().Skeleton.Skin = null;
}
if (Input.GetButtonDown("Fire2"))
{
SpineCG2.GetComponent<SkeletonAnimation>().skeletonDataAsset = null;
}
}
ページ 1 / 1
kenjizenki
添付ファイルを見るにはパーミッションが必要です
8 months ago
-
kenjizenki - 記事: 32
Harald
見逃している呼び出しは
リソースからのskeletonDataのロードとアンロードを扱う古いスレッドがここにあります。
How to dynamically load/unload Skeleton Data Assets
I think the call you are missing is
There is an older thread that deals with loading and unloading skeletonData from Resources here, in case it helps:
How to dynamically load/unload Skeleton Data Assets
SkeletonGraphic
I have added a translation from another thread with a short code sample that works with
skeletonAnimation.Initialize(true);
ではないかと思います。リソースからのskeletonDataのロードとアンロードを扱う古いスレッドがここにあります。
How to dynamically load/unload Skeleton Data Assets
I think the call you are missing is
skeletonAnimation.Initialize(true);
.There is an older thread that deals with loading and unloading skeletonData from Resources here, in case it helps:
How to dynamically load/unload Skeleton Data Assets
SkeletonGraphic
で動作する短いコードサンプルを別のスレッドから翻訳したものを追加しましたが、
SkeletonAnimation` でも同様に動作するはずです。I have added a translation from another thread with a short code sample that works with
SkeletonGraphic
, however it should work with SkeletonAnimation
just as well:そうしないと、以前に設定したスキン名の残りがInitialize()
で古いスキン名を探してエラーになる可能性があることに注意してください。
Please note that you might have to setinitialSkinName
as well, otherwise it will be a remainder of the previously set skin name that could be causing an error duringInitialize()
, looking for the old skin name.
SkeletonGraphicの場合は、SetMaterialDirty()
でMaskableGraphic部分を更新する必要があります。
In the case of SkeletonGraphic, you also have to be sure to update the MaskableGraphic part viaSetMaterialDirty()
.
関連するコードは以下の通りである。
The relevant code is as follows:skeletonGraphic.initialSkinName = "goblin";
skeletonGraphic.startingAnimation = "";
skeletonGraphic.Initialize(true);
skeletonGraphic.AnimationState.SetAnimation(0, "walk", true);
skeletonGraphic.SetMaterialDirty(); //<-- you can remove this line forSkeletonAnimation
8 months ago
-
Harald - 記事: 2422
kenjizenki
ありがとうございます。
もらった情報と私の知っている情報を組み合わせて、これで消えることを確認しました。
public void SpineGirlDisappear()
{
SpineGirl.GetComponent<SkeletonAnimation>().skeletonDataAsset = null;
SpineGirl.GetComponent<SkeletonAnimation>().ClearState();
SpineGirl.GetComponent<SkeletonAnimation>().Initialize(true);
}
もらった情報と私の知っている情報を組み合わせて、これで消えることを確認しました。
public void SpineGirlDisappear()
{
SpineGirl.GetComponent<SkeletonAnimation>().skeletonDataAsset = null;
SpineGirl.GetComponent<SkeletonAnimation>().ClearState();
SpineGirl.GetComponent<SkeletonAnimation>().Initialize(true);
}
8 months ago
-
kenjizenki - 記事: 32
Harald
返事をくれてありがとう うまくいったと聞いて嬉しいよ
Thanks for getting back to us. Glad to hear you got it worked out.
Thanks for getting back to us. Glad to hear you got it worked out.
8 months ago
-
Harald - 記事: 2422
Mark topic unread
• ページ 1 / 1
Return to 日本のSpine ユーザー
- All times are UTC