Hi.
I'm trying to get my variable,
grid_01_value into PlayMaker from a script, but I can't find evidence of it being read by my FSM. I'm using
Get Property and dragged the component itself into the Target Object field.
grid_01_value is a public variable and I can list it as the Property. I then store it as
01_int_display_g. I'm then trying to convert and view the result. This is where I can't get a result.
Here is the FSM.
The variable
grid_01_value is set from this code:
[size=8pt]using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Read_From_Centre : MonoBehaviour {
public UICenterOnChild myGrid;
public int grid_01_value;
public GameObject[] gridItems = new GameObject[4];
public void knowWhatIsCentered(GameObject _centeredItem)
{
if(_centeredItem == gridItems[0])
{
print("item 0 selected");
grid_01_value = 0;
Debug.Log("grid_01_value = " + grid_01_value);
}
else if(_centeredItem == gridItems[1])
{
print("item 1 selected");
grid_01_value = 1;
Debug.Log("grid_01_value = " + grid_01_value);
}
else if(_centeredItem == gridItems[2])
{
print("item 2 selected");
grid_01_value = 2;
Debug.Log("grid_01_value = " + grid_01_value);
}
else
{
print("item 3 selected");
grid_01_value = 3;
Debug.Log("grid_01_value = " + grid_01_value);
}
}
// Use this for initialization
void Start () {
myGrid.onCenter = knowWhatIsCentered;
}
// Update is called once per frame
void Update () {
}
}[/size]
I'm a complete scripting n00b and the above is mostly copied, but it is working as intended. I attach this script to a GameObject and fill the Public field "My Grid" with the NGUI Scroll grid object. I then populate the other fields with the grid objects. All of this part works.
I've noticed the FSM state "Get and Convert Grid Value" doesn't pulse green when I click on the scroller. The debug console updates with the correct values, but my data isn't getting into PM.
edit: Forgot to mention that the NGUI Label , irrespective of my scroller selection, sits on 0.
I'd appreciate some help. Thanks.