playMaker

Author Topic: [SOLVED]Get property and Set property = different access?  (Read 4839 times)

Lobohotpants

  • Playmaker Newbie
  • *
  • Posts: 38
[SOLVED]Get property and Set property = different access?
« on: March 12, 2013, 02:57:45 PM »
I'm having an issue with get and set property.  There's a property that I want to get on a script and be able to sort through a list to find them based on that property.  Unfortunately when I set up the get property action, the property isn't available.  Now, when I use a set property action the property becomes available and I can access the property. 

I know little about code but I've checked the script and the property is a public variable.  I'm just trying to understand why it would be available in one action but not the other.
« Last Edit: March 13, 2013, 04:09:06 PM by Lobohotpants »

Lobohotpants

  • Playmaker Newbie
  • *
  • Posts: 38
Re: Get property and Set property = different access?
« Reply #1 on: March 13, 2013, 11:18:44 AM »
Anybody have an idea?  This is really holding up my development.

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Get property and Set property = different access?
« Reply #2 on: March 13, 2013, 11:26:27 AM »
Is it on a prefab?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Get property and Set property = different access?
« Reply #3 on: March 13, 2013, 11:36:43 AM »
Set Property can set enums, but Get Property cannot get enums yet...

Is that what you're seeing?

Also Set Property will filter readonly variables, and neither action can access static variables yet.

Lobohotpants

  • Playmaker Newbie
  • *
  • Posts: 38
Re: Get property and Set property = different access?
« Reply #4 on: March 13, 2013, 12:28:17 PM »
Alex, yes that's exactly what it is.   I'm trying to get this property "public enum TileType"

Is there a workaround I can try or some other way of catching that property?

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Get property and Set property = different access?
« Reply #5 on: March 13, 2013, 12:54:07 PM »
Is it your script? If so you could create an int wrapper property for the enum that Get Property can see...

Lobohotpants

  • Playmaker Newbie
  • *
  • Posts: 38
Re: Get property and Set property = different access?
« Reply #6 on: March 13, 2013, 01:13:45 PM »
Hey Alex.  Thanks for the replies on this.  Unfortunately I don't know how to create an wrapper.  Coding is not my strength.  The script is from a package I bought off the asset store so it's ok to modify. 

If I sent you the script would you be able to look at it?  It seems like a simple fix but I just don't know enough about it.

Jake

  • Junior Playmaker
  • **
  • Posts: 61
    • Fluffy Underware
Re: Get property and Set property = different access?
« Reply #7 on: March 13, 2013, 03:01:41 PM »
Out of my mind, but should work:

Code: [Select]
// the enum you're interested in
public TileType Tile;
// the int wrapper
public int TileInt
{
 get { return (int)Tile; }
 set { Tile = (TileType)value; }
}

Replace "Tiletype" with the enum type in question and "Tile" with the name of the public enum variable you're interested in. Then access TileInt from playMaker (of might want to rename it to something nice).

Jake

Lobohotpants

  • Playmaker Newbie
  • *
  • Posts: 38
Re: Get property and Set property = different access?
« Reply #8 on: March 13, 2013, 04:08:44 PM »
Alex, I got your message.  Thank you.

Jake, I tried it out and it seems to be working fine.  Thank you so much for the help.  Though, my name is Jake too so can I say I figured it out? :D  Here's what I ended up with in case anyone else has this problem.

Code: [Select]
public int TileInt
{
get { return (int)tileTypeMask; }
set { tileTypeMask = (TileType)value; }
}