Hi guys, I am having a hard time finding information about how to set a playmaker variable from a variable that is in a script.
I have a gameobject that has a script attached to it. That script has a variable like this:
(I edited out all the other stuff that is not needed for this)
using UnityEngine;
using System.Collections;
using HutongGames.PlayMaker;
public class LevelAttributes : MonoBehaviour {
public Vector3[] quePositions = new Vector3[5];
void Start () {
setUpQue();
}
void setUpQue()
{
//Debug.Log("getting bubble size setupque");
bubbleSize = GameStateMenu.GetBubbleSize();
quePositions[0].x = shootFrom.x + (bubbleSize);
quePositions[0].y = shootFrom.y - (bubbleSize);
quePositions[0].z = shootFrom.z ;
quePositions[1].x = shootFrom.x + (bubbleSize*2);
quePositions[1].y = shootFrom.y - (bubbleSize);
quePositions[1].z = shootFrom.z ;
quePositions[2].x = shootFrom.x + (bubbleSize*3);
quePositions[2].y = shootFrom.y - (bubbleSize);
quePositions[2].z = shootFrom.z ;
quePositions[3].x = shootFrom.x + (bubbleSize*4);
quePositions[3].y = shootFrom.y - (bubbleSize);
quePositions[3].z = shootFrom.z ;
quePositions[4].x = shootFrom.x + (bubbleSize*5);
quePositions[4].y = shootFrom.y - (bubbleSize);
quePositions[4].z = shootFrom.z ;
}
}
In the FSM for the gameobjects I then need to move to these positions depending on what state they are in.
I created Vector3 variables IN the FSM, but can not figure out how to set those variable from the script, or if thats even the best way to do it.
I tried adding objects, setting those objects positions in the setUpQue(), then using MoveTowards. That would only let me select the objects prefab (it wont let me set the one that is actually in the scene) as the object to move towards, so it moves towards its default position (0,0,0) and not its position that is updated in the scene.
So whats the best way to go about this?
Sorry if this is common knowledge, I just cant seem to find it in the manual