playMaker

Author Topic: Get public static int from script  (Read 3180 times)

stitchlips

  • Playmaker Newbie
  • *
  • Posts: 18
Get public static int from script
« on: May 29, 2016, 12:08:16 AM »
I have a score script that of all things keeps track of score ::). Here is the code.

Code: [Select]
using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class Point_giver : MonoBehaviour
{
public static int score;        // The player's score.


TextMesh text;                      // Reference to the Text component.


void Awake ()
{
// Set up the reference.
text = GetComponent <TextMesh> ();

// Reset the score.
score = 0;
}


void Update ()
{
// Set the displayed text to be the word "Score" followed by the score value.
text.text = "Score: " + score;
}
}

How do I access the text.text portion in Playmaker? I have tried get property but it only returns the words text and length.

ergin

  • Junior Playmaker
  • **
  • Posts: 86
Re: Get public static int from script
« Reply #1 on: May 29, 2016, 05:10:13 AM »
Did you try sendmessage? Although it is named send, it has access to many get methods.

PlaymakerNOOB

  • Full Member
  • ***
  • Posts: 219
Re: Get public static int from script
« Reply #2 on: May 29, 2016, 08:19:58 AM »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Get public static int from script
« Reply #3 on: May 29, 2016, 09:25:52 AM »
Get property doesn't work on static variables. Create a public property in your script and in the get/set methods return the static variable.

Similar to here http://hutonggames.com/playmakerforum/index.php?topic=12868.msg60054#msg60054
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

stitchlips

  • Playmaker Newbie
  • *
  • Posts: 18
Re: Get public static int from script
« Reply #4 on: May 29, 2016, 10:42:32 AM »
Thanks Lane, I will try the thread you linked to and see what I can get. I'm not too sure how to make the public variable in my score script.