playMaker

Author Topic: Can't Set Properties in c# script  (Read 3603 times)

vrpostcard

  • Playmaker Newbie
  • *
  • Posts: 9
Can't Set Properties in c# script
« 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.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: Can't Set Properties in c# script
« Reply #1 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...

vrpostcard

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Can't Set Properties in c# script
« Reply #2 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.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: Can't Set Properties in c# script
« Reply #3 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.

vrpostcard

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Can't Set Properties in c# script
« Reply #4 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.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: Can't Set Properties in c# script
« Reply #5 on: September 08, 2013, 07:39:13 AM »
And you don't see a property called Cycle in the Set Property menu?

vrpostcard

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Can't Set Properties in c# script
« Reply #6 on: September 08, 2013, 07:49:48 AM »
No.  I can't see it at all.  It really has me stumped.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4002
  • Official Playmaker Support
    • LinkedIn
Re: Can't Set Properties in c# script
« Reply #7 on: September 08, 2013, 07:53:00 AM »
I'll try to recreate the setup here and see what I get...

vrpostcard

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Can't Set Properties in c# script
« Reply #8 on: September 08, 2013, 07:55:22 AM »
That would be great, many thanks for your help.

vrpostcard

  • Playmaker Newbie
  • *
  • Posts: 9
Re: Can't Set Properties in c# script
« Reply #9 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!