Esempio n. 1
0
        /**
         * The main Constructor.
         * An array of ID numbers is required, to ensure its own ID is unique.
         */
        public GVar(int[] idArray)
        {
            val = 0;
            floatVal = 0f;
            textVal = "";
            type = VariableType.Boolean;
            id = 0;
            link = VarLink.None;
            pmVar = "";
            popUps = null;
            updateLinkOnStart = false;
            backupVal = 0;
            backupFloatVal = 0f;

            // Update id based on array
            foreach (int _id in idArray)
            {
                if (id == _id)
                {
                    id ++;
                }
            }

            label = "Variable " + (id + 1).ToString ();
        }
Esempio n. 2
0
        /**
         * The main Constructor.
         * An array of ID numbers is required, to ensure its own ID is unique.
         */
        public GVar(int[] idArray)
        {
            val               = 0;
            floatVal          = 0f;
            textVal           = "";
            type              = VariableType.Boolean;
            id                = 0;
            link              = VarLink.None;
            pmVar             = "";
            popUps            = null;
            updateLinkOnStart = false;
            backupVal         = 0;
            backupFloatVal    = 0f;
            textValLineID     = -1;
            popUpsLineID      = -1;

            // Update id based on array
            foreach (int _id in idArray)
            {
                if (id == _id)
                {
                    id++;
                }
            }

            label = "Variable " + (id + 1).ToString();
        }
Esempio n. 3
0
        /**
         * The main Constructor.
         * An array of ID numbers is required, to ensure its own ID is unique.
         */
        public GVar(int[] idArray)
        {
            val               = 0;
            floatVal          = 0f;
            textVal           = string.Empty;
            type              = VariableType.Boolean;
            link              = VarLink.None;
            pmVar             = string.Empty;
            popUps            = null;
            updateLinkOnStart = false;
            backupVal         = 0;
            backupFloatVal    = 0f;
            textValLineID     = -1;
            popUpsLineID      = -1;
            canTranslate      = true;
            vector3Val        = Vector3.zero;
            popUpID           = 0;

            AssignUniqueID(idArray);

            label = "Variable " + (id + 1).ToString();

                        #if UNITY_EDITOR
            description = string.Empty;
                        #endif
        }
Esempio n. 4
0
		public GVar ()
		{
			val = 0;
			floatVal = 0f;
			textVal = "";
			type = VariableType.Boolean;
			id = 0;
			link = VarLink.None;
			pmVar = "";
			popUps = null;
			updateLinkOnStart = false;

			label = "Variable " + (id + 1).ToString ();
		}
Esempio n. 5
0
 /**
  * A Constructor that copies all values from another variable.
  * This way ensures that no connection remains to the asset file.
  */
 public GVar(GVar assetVar)
 {
     val               = assetVar.val;
     floatVal          = assetVar.floatVal;
     textVal           = assetVar.textVal;
     type              = assetVar.type;
     id                = assetVar.id;
     label             = assetVar.label;
     link              = assetVar.link;
     pmVar             = assetVar.pmVar;
     popUps            = assetVar.popUps;
     updateLinkOnStart = assetVar.updateLinkOnStart;
     backupVal         = assetVar.val;
     backupFloatVal    = assetVar.floatVal;
 }
Esempio n. 6
0
        public GVar()
        {
            val               = 0;
            floatVal          = 0f;
            textVal           = "";
            type              = VariableType.Boolean;
            id                = 0;
            link              = VarLink.None;
            pmVar             = "";
            popUps            = null;
            updateLinkOnStart = false;
            backupVal         = 0;
            backupFloatVal    = 0f;

            label = "Variable " + (id + 1).ToString();
        }
Esempio n. 7
0
        public GVar(GVar assetVar)
        {
            // Duplicates Asset to Runtime instance
            // (Do it the long way to ensure no connections remain to the asset file)

            val               = assetVar.val;
            floatVal          = assetVar.floatVal;
            textVal           = assetVar.textVal;
            type              = assetVar.type;
            id                = assetVar.id;
            label             = assetVar.label;
            link              = assetVar.link;
            pmVar             = assetVar.pmVar;
            popUps            = assetVar.popUps;
            updateLinkOnStart = assetVar.updateLinkOnStart;
            backupVal         = assetVar.val;
            backupFloatVal    = assetVar.floatVal;
        }
Esempio n. 8
0
 /**
  * A Constructor that copies all values from another variable.
  * This way ensures that no connection remains to the asset file.
  */
 public GVar(GVar assetVar)
 {
     val               = assetVar.val;
     floatVal          = assetVar.floatVal;
     textVal           = assetVar.textVal;
     type              = assetVar.type;
     id                = assetVar.id;
     label             = assetVar.label;
     link              = assetVar.link;
     pmVar             = assetVar.pmVar;
     popUps            = assetVar.popUps;
     updateLinkOnStart = assetVar.updateLinkOnStart;
     backupVal         = assetVar.val;
     backupFloatVal    = assetVar.floatVal;
     textValLineID     = assetVar.textValLineID;
     popUpsLineID      = assetVar.popUpsLineID;
     canTranslate      = assetVar.canTranslate;
     vector3Val        = assetVar.vector3Val;
 }
Esempio n. 9
0
        /**
         * A Constructor that copies all values from another variable.
         * This way ensures that no connection remains to the asset file.
         */
        public GVar(GVar assetVar)
        {
            val               = assetVar.val;
            floatVal          = assetVar.floatVal;
            textVal           = assetVar.textVal;
            type              = assetVar.type;
            id                = assetVar.id;
            label             = assetVar.label;
            link              = assetVar.link;
            pmVar             = assetVar.pmVar;
            popUps            = assetVar.popUps;
            updateLinkOnStart = assetVar.updateLinkOnStart;
            backupVal         = assetVar.val;
            backupFloatVal    = assetVar.floatVal;
            textValLineID     = assetVar.textValLineID;
            popUpsLineID      = assetVar.popUpsLineID;
            canTranslate      = assetVar.canTranslate;
            vector3Val        = assetVar.vector3Val;
            popUpID           = assetVar.popUpID;

                        #if UNITY_EDITOR
            description = assetVar.description;
                        #endif
        }
Esempio n. 10
0
 protected void GetVarLinks()
 {
     Varlinks = new List<VarLink>();
     byte[] buff = pcc.Exports[index].Data;
     List<SaltPropertyReader.Property> p = SaltPropertyReader.getPropList(pcc, buff);
     int f = -1;
     for (int i = 0; i < p.Count(); i++)
         if (p[i].Name == "VariableLinks")
         {
             f = i;
             break;
         }
     if (f != -1)
     {
         int pos = 28;
         byte[] global = p[f].raw;
         BitConverter.IsLittleEndian = true;
         int count = BitConverter.ToInt32(global, 24);
         VarLink l = new VarLink();
         for (int j = 0; j < count; j++)
         {
             List<SaltPropertyReader.Property> p2 = SaltPropertyReader.ReadProp(pcc, global, pos);
             for (int i = 0; i < p2.Count(); i++)
             {
                 pos += p2[i].raw.Length;
                 if (p2[i].Name == "LinkedVariables")
                 {
                     int count2 = BitConverter.ToInt32(p2[i].raw, 24);
                     l.Links = new List<int>();
                     l.offsets = new List<int>();
                     if (count2 != 0)
                     {
                         for (int k = 0; k < count2; k += 1)
                         {
                             l.Links.Add(BitConverter.ToInt32(p2[i].raw, 28 + k*4) - 1);
                             l.offsets.Add(pos + 28 + k*4 - p2[i].raw.Length);
                         }
                     }
                     else
                     {
                         l.Links.Add(-1);
                         l.offsets.Add(-1);
                     }
                 }
                 else if (p2[i].Name == "ExpectedType")
                 {
                     l.type = getType(pcc.GetClass(p2[i].Value.IntValue));
                 }
                 else if (p2[i].Name == "LinkDesc")
                 {
                     l.Desc = p2[i].Value.StringValue;
                     if (l.Desc.EndsWith("\0"))
                         l.Desc = l.Desc.Substring(0, l.Desc.Length - 1);
                 }
                 else if (p2[i].Name == "bWriteable")
                 {
                     l.writeable = p2[i].Value.IntValue == 1;
                     if (l.writeable)
                     {//downward pointing triangle
                         l.node = PPath.CreatePolygon(new PointF[] { new PointF(-4, 0), new PointF(4, 0), new PointF(0, 10) });
                         l.node.AddChild(PPath.CreatePolygon(new PointF[] { new PointF(-4, 0), new PointF(4, 0), new PointF(0, 10) }));
                     }
                     else
                     {
                         l.node = PPath.CreateRectangle(-4, 0, 8, 10);
                         l.node.AddChild(PPath.CreateRectangle(-4, 0, 8, 10));
                     }
                 }
             }
             if (l.Links != null)
             {
                 if(l.node == null)
                 {
                     l.node = PPath.CreateRectangle(-4, 0, 8, 10);
                     l.node.AddChild(PPath.CreateRectangle(-4, 0, 8, 10));
                 }
                 l.node.Brush = new SolidBrush(getColor(l.type));
                 l.node.Pen = new Pen(getColor(l.type));
                 l.node.Pickable = false;
                 l.node[0].Brush = new SolidBrush(Color.FromArgb(1, 255, 255, 255));
                 ((PPath)l.node[0]).Pen = l.node.Pen;
                 l.node[0].X = l.node.X;
                 l.node[0].Y = l.node.Y;
                 l.node[0].AddInputEventListener(new VarDragHandler());
                 Varlinks.Add(l);
             }
         }
     }
 }
Esempio n. 11
0
        public void CreateVarlink(PNode p1, SVar end)
        {
            SBox start = (SBox)p1.Parent.Parent.Parent;
            byte[] buff = pcc.Exports[start.Index].Data;
            List<byte> ListBuff = new List<byte>(buff);
            VarLink link = new VarLink();
            bool firstLink = false;
            foreach (VarLink l in start.Varlinks)
            {
                if (l.node == p1)
                {
                    if (l.Links.Contains(end.Index))
                        return;
                    if (l.Links[0] == -1)
                    {
                        firstLink = true;
                        l.Links.RemoveAt(0);
                        l.offsets.RemoveAt(0);
                    }
                    else
                    {
                        l.offsets.Add(l.offsets[l.offsets.Count -1] + 4);
                    }
                    l.Links.Add(end.Index);
                    link = l;
                    break;
                }
            }
            if(link.Links == null)
                return;
            BitConverter.IsLittleEndian = true;
            List<SaltPropertyReader.Property> p = SaltPropertyReader.getPropList(pcc, buff);
            int f = -1;
            for (int i = 0; i < p.Count(); i++)
            {
                if (p[i].Name == "VariableLinks")
                {

                    byte[] sizebuff = BitConverter.GetBytes(BitConverter.ToInt32(p[i].raw, 16) + 4);
                    for (int j = 0; j < 4; j++)
                    {
                        ListBuff[p[i].offsetval - 8 + j] = sizebuff[j];
                    }
                    f = i;
                    break;
                }
            }
            if (f != -1)
            {
                int pos = 28;
                byte[] global = p[f].raw;
                int count = BitConverter.ToInt32(global, 24);
                for(int j = 0; j < count; j++)
                {
                    List<SaltPropertyReader.Property> p2 = SaltPropertyReader.ReadProp(pcc, global, pos);
                    for (int i = 0; i < p2.Count(); i++)
                    {
                        if (p2[i].Name == "LinkedVariables" && p2[i + 1].Value.StringValue == link.Desc + '\0')
                        {
                            if (firstLink)
                                link.offsets.Add(pos + 28);
                            int count2 = BitConverter.ToInt32(p2[i].raw, 24);
                            byte[] countbuff = BitConverter.GetBytes(count2 + 1);
                            byte[] sizebuff = BitConverter.GetBytes(BitConverter.ToInt32(p2[i].raw, 16) + 4);
                            for(int k = 0; k < 4; k++)
                            {
                                ListBuff[p[f].offsetval + pos + k] = countbuff[k];
                                ListBuff[p[f].offsetval + pos - 8 + k] = sizebuff[k];
                            }
                            ListBuff.InsertRange(p[f].offsetval + pos + 4 + count2 * 4, BitConverter.GetBytes(end.Index + 1));
                            pcc.Exports[start.Index].Data = ListBuff.ToArray();
                            j = count; //break outer loop
                            break;
                        }
                        pos += p2[i].raw.Length;
                    }
                }
            }
            refreshView();
        }
Esempio n. 12
0
 /**
  * A Constructor that copies all values from another variable.
  * This way ensures that no connection remains to the asset file.
  */
 public GVar(GVar assetVar)
 {
     val = assetVar.val;
     floatVal = assetVar.floatVal;
     textVal = assetVar.textVal;
     type = assetVar.type;
     id = assetVar.id;
     label = assetVar.label;
     link = assetVar.link;
     pmVar = assetVar.pmVar;
     popUps = assetVar.popUps;
     updateLinkOnStart = assetVar.updateLinkOnStart;
     backupVal = assetVar.val;
     backupFloatVal = assetVar.floatVal;
 }
Esempio n. 13
0
		public GVar (GVar assetVar)
		{
			// Duplicates Asset to Runtime instance
			// (Do it the long way to ensure no connections remain to the asset file)
			
			val = assetVar.val;
			floatVal = assetVar.floatVal;
			textVal = assetVar.textVal;
			type = assetVar.type;
			id = assetVar.id;
			label = assetVar.label;
			link = assetVar.link;
			pmVar = assetVar.pmVar;
			popUps = assetVar.popUps;
			updateLinkOnStart = assetVar.updateLinkOnStart;
		}
Esempio n. 14
0
 protected void GetVarLinks()
 {
     Varlinks = new List<VarLink>();
     var varLinksProp = export.GetProperty<ArrayProperty<StructProperty>>("VariableLinks");
     if (varLinksProp != null)
     {
         foreach (var prop in varLinksProp)
         {
             PropertyCollection props = prop.Properties;
             var linkedVars = props.GetProp<ArrayProperty<ObjectProperty>>("LinkedVariables");
             if (linkedVars != null)
             {
                 VarLink l = new VarLink();
                 l.Links = new List<int>();
                 l.Desc = props.GetProp<StrProperty>("LinkDesc");
                 if (linkedVars.Count != 0)
                 {
                     foreach (var objProp in linkedVars)
                     {
                         l.Links.Add(objProp.Value - 1);
                     }
                 }
                 else
                 {
                     l.Links.Add(-1);
                 }
                 l.type = getType(pcc.getClassName(props.GetProp<ObjectProperty>("ExpectedType").Value));
                 l.writeable = props.GetProp<BoolProperty>("bWriteable").Value;
                 if (l.writeable)
                 {   
                     //downward pointing triangle
                     l.node = PPath.CreatePolygon(new PointF[] { new PointF(-4, 0), new PointF(4, 0), new PointF(0, 10) });
                     l.node.AddChild(PPath.CreatePolygon(new PointF[] { new PointF(-4, 0), new PointF(4, 0), new PointF(0, 10) }));
                 }
                 else
                 {
                     l.node = PPath.CreateRectangle(-4, 0, 8, 10);
                     l.node.AddChild(PPath.CreateRectangle(-4, 0, 8, 10));
                 }
                 l.node.Brush = new SolidBrush(getColor(l.type));
                 l.node.Pen = new Pen(getColor(l.type));
                 l.node.Pickable = false;
                 l.node[0].Brush = mostlyTransparentBrush;
                 ((PPath)l.node[0]).Pen = l.node.Pen;
                 l.node[0].X = l.node.X;
                 l.node[0].Y = l.node.Y;
                 l.node[0].AddInputEventListener(new VarDragHandler());
                 Varlinks.Add(l);
             }
         }
     }
 }
Esempio n. 15
0
        public void ShowGUI(VariableLocation location, bool canEdit, List <VarPreset> _varPresets = null, string apiPrefix = "", Variables _variables = null)
        {
            string labelPrefix = (canEdit) ? "Initial value:" : "Current value:";
            string helpText    = (canEdit) ? "Its initial value" : "Its current value";

            if (!canEdit && HasTranslations() && Options.GetLanguage() > 0)
            {
                labelPrefix = "Original language value:";
            }

            if (canEdit)
            {
                label = CustomGUILayout.TextField("Label:", label, apiPrefix + ".label", "Its editor name");
                type  = (VariableType)CustomGUILayout.EnumPopup("Type:", type, apiPrefix + ".type", "Its variable type");
            }
            else
            {
                EditorGUILayout.LabelField("Label: " + label);
                EditorGUILayout.LabelField("Type: " + type.ToString());
            }

            switch (type)
            {
            case VariableType.Boolean:
                if (val != 1)
                {
                    val = 0;
                }
                val = CustomGUILayout.Popup(labelPrefix, val, boolType, apiPrefix + ".BooleanValue", helpText);
                break;

            case VariableType.Float:
                floatVal = CustomGUILayout.FloatField(labelPrefix, floatVal, apiPrefix + ".FloatValue", helpText);
                break;

            case VariableType.Integer:
                val = CustomGUILayout.IntField(labelPrefix, val, apiPrefix + ".IntegerValue", helpText);
                break;

            case VariableType.PopUp:
                Object objectToRecord = null;
                if (location == VariableLocation.Global)
                {
                    objectToRecord = KickStarter.variablesManager;
                }
                if (location == VariableLocation.Local)
                {
                    objectToRecord = KickStarter.localVariables;
                }
                if (location == VariableLocation.Component)
                {
                    objectToRecord = _variables;
                }

                VariablesManager.ShowPopUpLabelsGUI(this, canEdit, objectToRecord);

                if (GetNumPopUpValues() > 0)
                {
                    string[] popUpLabels = GenerateEditorPopUpLabels();
                    val = CustomGUILayout.Popup(labelPrefix, val, popUpLabels, apiPrefix + ".IntegerValue", helpText);
                }
                else
                {
                    val = 0;
                }

                if (popUpID > 0)
                {
                    if (Application.isPlaying && canTranslate)
                    {
                        EditorGUILayout.LabelField("Values can be translated");
                    }
                }
                else
                {
                    if (canEdit)
                    {
                        canTranslate = CustomGUILayout.Toggle("Values can be translated?", canTranslate, apiPrefix + ".canTranslate", "If True, the variable's value can be translated");
                    }
                    else if (canTranslate)
                    {
                        EditorGUILayout.LabelField("Values can be translated");
                    }
                }
                break;

            case VariableType.String:
                EditorGUILayout.BeginHorizontal();
                CustomGUILayout.LabelField(labelPrefix, GUILayout.Width(140f), apiPrefix + ".TextValue");
                EditorStyles.textField.wordWrap = true;
                textVal = CustomGUILayout.TextArea(textVal, GUILayout.MaxWidth(800f), apiPrefix + ".TextValue");
                EditorGUILayout.EndHorizontal();

                if (canEdit)
                {
                    canTranslate = CustomGUILayout.Toggle("Values can be translated?", canTranslate, apiPrefix + ".canTranslate", "If True, the variable's value can be translated");
                }
                else if (canTranslate)
                {
                    EditorGUILayout.LabelField("Values can be translated");
                }
                break;

            case VariableType.Vector3:
                vector3Val = CustomGUILayout.Vector3Field(labelPrefix, vector3Val, apiPrefix + ".Vector3Value", helpText);
                break;
            }

            switch (location)
            {
            case VariableLocation.Global:
                CustomGUILayout.TokenLabel("[var:" + id.ToString() + "]");
                break;

            case VariableLocation.Local:
                CustomGUILayout.TokenLabel("[localvar:" + id.ToString() + "]");
                break;

            case VariableLocation.Component:
                if (_variables != null)
                {
                    ConstantID _constantID = _variables.GetComponent <ConstantID> ();
                    if (_constantID != null && _constantID.constantID != 0)
                    {
                        CustomGUILayout.TokenLabel("[compvar:" + _constantID.constantID.ToString() + ":" + id.ToString() + "]");
                    }
                }
                break;
            }

            if (_varPresets != null)
            {
                EditorGUILayout.Space();
                foreach (VarPreset _varPreset in _varPresets)
                {
                    // Local
                    string apiPrefix2 = (location == VariableLocation.Local) ?
                                        "AC.KickStarter.localVariables.GetPreset (" + _varPreset.ID + ").GetPresetValue (" + id + ")" :
                                        "AC.KickStarter.runtimeVariables.GetPreset (" + _varPreset.ID + ").GetPresetValue (" + id + ")";

                    _varPreset.UpdateCollection(this);

                    string label = "'" +
                                   (!string.IsNullOrEmpty(_varPreset.label) ? _varPreset.label : ("Preset #" + _varPreset.ID.ToString())) +
                                   "' value:";

                    PresetValue presetValue = _varPreset.GetPresetValue(this);
                    switch (type)
                    {
                    case VariableType.Boolean:
                        presetValue.val = CustomGUILayout.Popup(label, presetValue.val, boolType, apiPrefix2 + ".BooleanValue");
                        break;

                    case VariableType.Float:
                        presetValue.floatVal = CustomGUILayout.FloatField(label, presetValue.floatVal, apiPrefix2 + ".FloatValue");
                        break;

                    case VariableType.Integer:
                        presetValue.val = CustomGUILayout.IntField(label, presetValue.val, apiPrefix2 + ".IntegerValue");
                        break;

                    case VariableType.PopUp:
                        presetValue.val = CustomGUILayout.Popup(label, presetValue.val, popUps, apiPrefix2 + ".IntegerValue");
                        break;

                    case VariableType.String:
                        presetValue.textVal = CustomGUILayout.TextField(label, presetValue.textVal, apiPrefix2 + ".TextValue");
                        break;

                    case VariableType.Vector3:
                        presetValue.vector3Val = CustomGUILayout.Vector3Field(label, presetValue.vector3Val, apiPrefix2 + ".Vector3Value");
                        break;
                    }
                }
            }

            EditorGUILayout.Space();
            if (canEdit)
            {
                switch (location)
                {
                case VariableLocation.Local:
                    link = VarLink.None;
                    break;

                case VariableLocation.Global:
                case VariableLocation.Component:
                    link = (VarLink)CustomGUILayout.EnumPopup("Link to:", link, apiPrefix + ".link", "What it links to");
                    if (link == VarLink.PlaymakerVariable)
                    {
                        if (PlayMakerIntegration.IsDefinePresent())
                        {
                            if (location == VariableLocation.Global)
                            {
                                pmVar = CustomGUILayout.TextField("Playmaker Global Variable:", pmVar, apiPrefix + ".pmVar", "The name of the Playmaker variable to link to.");
                            }
                            else if (location == VariableLocation.Component)
                            {
                                if (_variables != null && PlayMakerIntegration.HasFSM(_variables.gameObject))
                                {
                                    pmVar = CustomGUILayout.TextField("Playmaker Local Variable:", pmVar, apiPrefix + ".pmVar", "The name of the Playmaker variable to link to. It is assumed to be placed on the same GameObject as this Variables component.");
                                }
                                else
                                {
                                    EditorGUILayout.HelpBox("A Playmaker FSM component must be present on the Variables GameObject.", MessageType.Info);
                                }
                            }

                            if (!string.IsNullOrEmpty(pmVar))
                            {
                                updateLinkOnStart = CustomGUILayout.Toggle("Use PM for initial value?", updateLinkOnStart, apiPrefix + ".updateLinkOnStart", "If True, then Playmaker will be referred to for the initial value");
                            }
                        }
                        else
                        {
                            EditorGUILayout.HelpBox("The 'PlayMakerIsPresent' Scripting Define Symbol must be listed in the\nPlayer Settings. Please set it from Edit -> Project Settings -> Player", MessageType.Warning);
                        }
                    }
                    else if (link == VarLink.OptionsData)
                    {
                        if (location == VariableLocation.Global)
                        {
                            EditorGUILayout.HelpBox("This Variable will be stored in PlayerPrefs, and not in saved game files.", MessageType.Info);
                        }
                        else
                        {
                            EditorGUILayout.HelpBox("Component variables cannot be linked to Options Data - use Global variables instead.", MessageType.Warning);
                        }
                    }
                    else if (link == VarLink.CustomScript)
                    {
                        updateLinkOnStart = CustomGUILayout.Toggle("Script sets initial value?", updateLinkOnStart, apiPrefix + ".updateLinkOnStart", "If True, then a custom script will be referred to for the initial value");
                        EditorGUILayout.HelpBox("See the Manual's 'Global variable linking' chapter for details on how to synchronise values.", MessageType.Info);
                    }
                    break;
                }
            }
            else
            {
                if (link != VarLink.None)
                {
                    EditorGUILayout.LabelField("Links to: " + link.ToString());
                    if (link == VarLink.PlaymakerVariable && !string.IsNullOrEmpty(pmVar))
                    {
                        EditorGUILayout.LabelField("Linked PM variable: " + pmVar);
                    }
                    if (link == VarLink.PlaymakerVariable || link == VarLink.CustomScript)
                    {
                        if (updateLinkOnStart)
                        {
                            EditorGUILayout.LabelField("Script sets initial value");
                        }
                    }
                }
            }

            if (canEdit)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent("Internal description:", "An Editor-only description to aid designers"), GUILayout.MaxWidth(146f));
                description = EditorGUILayout.TextArea(description);
                EditorGUILayout.EndHorizontal();
            }
            else
            {
                if (!string.IsNullOrEmpty(description))
                {
                    EditorGUILayout.LabelField("Internal description: " + description);
                }
            }
        }