playMaker

Author Topic: Support for Plane structs as a variable type  (Read 4243 times)

Allar

  • Playmaker Newbie
  • *
  • Posts: 1
Support for Plane structs as a variable type
« on: May 26, 2013, 08:05:20 PM »
I would like the ability to directly use UnityEngine.Plane as a variable type, or at least have some support in extending Playmaker easier with new variable types, or at the very least, allow UnityEngine.Plane to be exposed through the FSMObject variable type system.

At the moment, I can make custom actions that hide a lot of the Plane math I need to do, but it would be nice if I can work with Planes directly and have a Plane variable of some kind identifiable in the FSM so multiple actions can use it directly.

If there is a way to handle UnityEngine.Plane in Playmaker, I apologize. I only recently picked up Playmaker, and so far its simply fantastic. Just would like better struct support :D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Support for Plane structs as a variable type
« Reply #1 on: May 27, 2013, 01:17:47 AM »
Hi,

 simply create a "Object" class and store your plane struct inside, then you build the necessary custom actions to go with this.

 WARNING: Unity Object do not get garbage collected like you would expect. If you plan on declaring such Object very often, you will have to call manually UnloadUnusedAssets to avoid memory leaks, especially on Mobile.

bye,

 Jean

geo

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Support for Plane structs as a variable type
« Reply #2 on: September 08, 2023, 11:38:35 AM »
Sorry for necroing this decade old post. This one popped up in Google search so I guess it may be of interest to others too.

Has there been any development on this matter in the meantime or is wrapping the custom type in a UnityEngine.Object (like a ScriptableObject for example) still the recommended way to deal with this?

When looking at the source code I see that the value is actually stored as a "object" so it should be possible to use any type at runtime. However the property  SETTER casts anything that comes in to a UnityEngine.Object which shuts down any none-unity object from being stored (the cast will fail).

Code: [Select]
public override object RawValue
        {
            get
            {
                return value;
            }
            set
            {
                this.value = (UnityEngine.Object)value;
            }
        }

Thanks

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: Support for Plane structs as a variable type
« Reply #3 on: September 09, 2023, 06:28:11 AM »
Hi.
maybe the api page can help you out :
https://hutonggames.fogbugz.com/default.asp?W127

geo

  • Playmaker Newbie
  • *
  • Posts: 2
Re: Support for Plane structs as a variable type
« Reply #4 on: September 11, 2023, 08:30:10 AM »
Thanks.
I've asked a similar question in the Unity forum and got and answer there.

Quote "Alex-Chouls":
Quote
Right now the ScriptableObject workaround is required. However, PlayMaker2 has a much more flexible variable type system, and you will be able to easily make a variable of any type. We hope to have a beta version ready for testing soon!

Source: https://forum.unity.com/threads/playmaker-visual-scripting-for-unity.72349/page-70#post-9285226