Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: vrpostcard on September 07, 2013, 11:40:15 AM

Title: Can't Set Properties in c# script
Post by: vrpostcard on September 07, 2013, 11:40:15 AM
Could somebody please explain why I can't use the Set Properties action to change the float values as listed below?  My current knowledge of coding is zero although I can usually manage to work most things out with playmaker, but this one has me stumped.

When I drag this script into my FSM and as Set Properties, these parameters do not show up so that I can change them.  The parameters appear in the unity editor and I am able to change them there.

using UnityEngine;
using System;

[ExecuteInEditMode]
public class TOD_Sky : MonoBehaviour
{
    [Serializable]
    public class CycleParameters
    {
        public float TimeOfDay   = 12f;
        public float JulianDate  = 60f;
        public float Latitude    = 0f;
        public float Longitude   = 0f;
        public float UTC         = 0f;
    }

Many thanks in advance.
Title: Re: Can't Set Properties in c# script
Post by: Alex Chouls on September 07, 2013, 11:29:16 PM
I assume you declare a public field of type CycleParameters?
Do you see that field name in Set Property?
The CycleParameters parameters should be nested inside...
Title: Re: Can't Set Properties in c# script
Post by: vrpostcard on September 07, 2013, 11:58:55 PM
Alex, thanks for your reply.  I'm not quite sure what you are talking about but I'll see if I can read up on the subject. It seems to make sense that the variable are not being made public.

The script sample I provided is the very start of the script that I am trying to change the values in and other than the floats being made public which I assumed would make then visible to the Set Properties action I can kind of see the logic you have put forward.
Title: Re: Can't Set Properties in c# script
Post by: Alex Chouls on September 08, 2013, 12:38:58 AM
The code snippet declares a class. Later you must have: public CycleParameters [parameterName]

Look for that parameter name.
Title: Re: Can't Set Properties in c# script
Post by: vrpostcard on September 08, 2013, 12:55:16 AM
Alex,

Further down in the script is :

    // Component references
    // These are already setup in the prefab
    public GameObject SunInstance        = null;
    public GameObject MoonInstance       = null;
    public GameObject AtmosphereInstance = null;
    public GameObject CloudInstance      = null;
    public GameObject SpaceInstance      = null;
    public GameObject ProjectorInstance     = null;

    // Color space (can be linear or gamma)
    // This has to be set by the user
    public bool LinearLighting = false;

    // Dome parameters
    public CycleParameters Cycle  = null;
    public DayParameters   Day    = null;

And I can change the LinearLighting bool through Set Properties.  The SunInstance (and others in that group) shows in the list (nested as you suggest) but not the CycleParameters.
Title: Re: Can't Set Properties in c# script
Post by: Alex Chouls on September 08, 2013, 07:39:13 AM
And you don't see a property called Cycle in the Set Property menu?
Title: Re: Can't Set Properties in c# script
Post by: vrpostcard on September 08, 2013, 07:49:48 AM
No.  I can't see it at all.  It really has me stumped.
Title: Re: Can't Set Properties in c# script
Post by: Alex Chouls on September 08, 2013, 07:53:00 AM
I'll try to recreate the setup here and see what I get...
Title: Re: Can't Set Properties in c# script
Post by: vrpostcard on September 08, 2013, 07:55:22 AM
That would be great, many thanks for your help.
Title: Re: Can't Set Properties in c# script
Post by: vrpostcard on September 10, 2013, 07:03:16 AM
Alex, I've also tried using the send message action with zero results.  Still working on other options!