Hi,
trying to make a playmaker action for Gamecreator.
I'm having problems accessing the Gamecreator CharacterAttachments method, when trying to assign it i always get a null result. Can anyone with knowledge of Playmaker and Gamecreator have a look and point me in the right direction?
Thanks in advance,
Here's the code:
using UnityEngine;
using GameCreator.Characters;
using GameCreator.Core;
using UnityEngine.Events;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("GameCreator")]
public class test1 : FsmStateAction
{
[RequiredField]
[ObjectType(typeof(Character))]
[Tooltip("Character to attach to")]
public FsmOwnerDefault character;
[ObjectType(typeof(HumanBodyBones))]
[Tooltip("Bone where gameobject will be attached")]
public FsmEnum Bone;
[RequiredField]
[Tooltip("Gameobject to attach")]
public FsmGameObject objectToAttach;
[ObjectType(typeof(Space))]
[Tooltip("Space")]
public FsmEnum space;
[Tooltip("Position")]
public FsmVector3 position;
[Tooltip("Rotation")]
public FsmQuaternion rotation;
private Character _character1;
private CharacterAnimator _animator;
private CharacterAttachments _attachments;
private GameObject _object;
// Code that runs on entering the state.
public override void OnEnter()
{
var go = Fsm.GetOwnerDefaultTarget(character);
if (go == null) return;
_character1 = go.GetComponent<Character>();
_animator = _character1.GetCharacterAnimator();
_attachments = _animator.GetComponent<CharacterAttachments>();
_object = objectToAttach.Value;
if (_character1 == null) Debug.LogError("no character");
if (_animator == null) Debug.LogError("no animator");
if (_attachments == null) Debug.LogError("no attachments");
if (_object == null) Debug.LogError("no object");
Finish();
}
}
}