Hi Chris,
Are you able to help me create a custom action list where I can call the attachment switch in Spine, where the string param would be the attachment name?
skeletonAnimation.skeleton.SetAttachment("weapon_one_handed", "weapons/grenade_bomb");
Apparently you can also use a component that changes the slot.
Please see screenshots here:
https://drive.google.com/drive/folders/1h1DJo2Iy9GObZD7zEwShzWp0Cw7qcwel?usp=sharing
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
I have a similar script that you could help me adaptd, where you use a string to change the skin:
Awesome! thank you! Is it possible to set parameters for custom action scripts?
Yes - see this tutorial.
override public void ShowGUI (List<ActionParameter> parameters)
{
parameterID = Action.ChooseParameterGUI
("GameObject to affect:", parameters, parameterID, ParameterType.GameObject);
if (parameterID >= 0)
{
constantID = 0;
objectToAffect = null;
}
else
{
objectToAffect = (GameObject) EditorGUILayout.ObjectField
("GameObject to affect:", objectToAffect, typeof (GameObject), true);
constantID = FieldToID (objectToAffect, constantID);
objectToAffect = IDToField (objectToAffect, constantID, true);
}
}
No - the exact code you add is based on the fields you want to parameterise.
The code above is adapted from the previous tutorial.
To have a string parameter field override e.g. slotName with slotNameParameterID, replace:
with:
getting this error
Assets/Sleepytime Village/Scripts/Custom Actions5/ActionAttachmentSetter.cs(63,13): error CS0103: The name 'slotNameParameterID' does not exist in the current context
My code is below
You need to declare slotNameParameterID as a variable, as covered by the tutorial:
Thanks, there is a slight issue with this however, the slot name can stay the same but it is the attachment I need the parameter for, (or ideally both). However, I can only set a parameter for the slot name? Please see screenshots
https://drive.google.com/drive/folders/1hXwFGCTtYCH_SJXx0kFJxC_Im_d7QlGf?usp=share_link
You can parameterise any field in the same way - I'm trying to teach you with an example.
Make the same changes to your attachment field and you can parameterise that as well.
I got it! I think?
Add this to the AssignValues function:
Popped that line in, but there must be something missing with my script overall, It only lets me put one parameter in for both, se screenshot:
https://drive.google.com/drive/folders/1hXwFGCTtYCH_SJXx0kFJxC_Im_d7QlGf?usp=share_link
Replace:
with: