mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
[unity] Fixed Instantiate from Script example (missing script in SkeletonGraphic part), closes #294
This commit is contained in:
parent
5d50bf35b2
commit
65b7078ca3
@ -77,15 +77,17 @@ LightmapSettings:
|
||||
m_PVRDirectSampleCount: 32
|
||||
m_PVRSampleCount: 500
|
||||
m_PVRBounces: 2
|
||||
m_PVRFiltering: 0
|
||||
m_PVRFilterTypeDirect: 0
|
||||
m_PVRFilterTypeIndirect: 0
|
||||
m_PVRFilterTypeAO: 0
|
||||
m_PVRFilteringMode: 1
|
||||
m_PVRCulling: 1
|
||||
m_PVRFilteringGaussRadiusDirect: 1
|
||||
m_PVRFilteringGaussRadiusIndirect: 5
|
||||
m_PVRFilteringGaussRadiusAO: 2
|
||||
m_PVRFilteringAtrousColorSigma: 1
|
||||
m_PVRFilteringAtrousNormalSigma: 1
|
||||
m_PVRFilteringAtrousPositionSigma: 1
|
||||
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
|
||||
m_PVRFilteringAtrousPositionSigmaIndirect: 2
|
||||
m_PVRFilteringAtrousPositionSigmaAO: 1
|
||||
m_LightingDataAsset: {fileID: 0}
|
||||
m_ShadowMaskMode: 2
|
||||
--- !u!196 &4
|
||||
@ -362,13 +364,13 @@ MonoBehaviour:
|
||||
m_GameObject: {fileID: 1691562006}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 53c7df9ccd5732543bcd589e8270ba1c, type: 3}
|
||||
m_Script: {fileID: 11500000, guid: dd4ba29b300e5cc408471ea14fa3551a, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
skeletonDataAsset: {fileID: 11400000, guid: a467507a4ffb1d542a558739b2fede77, type: 2}
|
||||
startingAnimation: run
|
||||
startingSkin: base
|
||||
skeletonGraphicMaterial: {fileID: 2100000, guid: b66cf7a186d13054989b33a5c90044e4,
|
||||
skeletonGraphicMaterial: {fileID: 2100000, guid: 1455e88fdb81ccc45bdeaedd657bad4d,
|
||||
type: 2}
|
||||
--- !u!1 &1807176298
|
||||
GameObject:
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Spine.Unity.Examples {
|
||||
public class SpawnSkeletonGraphicExample : MonoBehaviour {
|
||||
|
||||
public SkeletonDataAsset skeletonDataAsset;
|
||||
|
||||
[SpineAnimation(dataField: "skeletonDataAsset")]
|
||||
public string startingAnimation;
|
||||
|
||||
[SpineSkin(dataField: "skeletonDataAsset")]
|
||||
public string startingSkin = "base";
|
||||
public Material skeletonGraphicMaterial;
|
||||
|
||||
IEnumerator Start () {
|
||||
if (skeletonDataAsset == null) yield break;
|
||||
skeletonDataAsset.GetSkeletonData(false); // Preload SkeletonDataAsset.
|
||||
yield return new WaitForSeconds(1f); // Pretend stuff is happening.
|
||||
|
||||
var sg = SkeletonGraphic.NewSkeletonGraphicGameObject(skeletonDataAsset, this.transform, skeletonGraphicMaterial); // Spawn a new SkeletonGraphic GameObject.
|
||||
sg.gameObject.name = "SkeletonGraphic Instance";
|
||||
|
||||
// Extra Stuff
|
||||
sg.Initialize(false);
|
||||
sg.Skeleton.SetSkin(startingSkin);
|
||||
sg.Skeleton.SetSlotsToSetupPose();
|
||||
sg.AnimationState.SetAnimation(0, startingAnimation, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dd4ba29b300e5cc408471ea14fa3551a
|
||||
timeCreated: 1547045161
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
x
Reference in New Issue
Block a user