using UnityEngine;
using System;
using UnityEngine.UI;
using Button = UnityEngine.UIElements.Button;
using Random = UnityEngine.Random;
namespace UnityEditor.Perception.Randomization
{
CreatePropertyFields();
CheckIfConstantsExist();
var randomSeedButton = m_Root.Q<Button>("random");
randomSeedButton.clicked += () =>
m_Scenario.genericConstants.randomSeed = (uint)Random.Range(int.MinValue, int.MaxValue);
};
var serializeConstantsButton = m_Root.Q<Button>("serialize");
serializeConstantsButton.clicked += () =>
<Foldout style="padding-left: 16px" text="Constants" name="constants-list" tooltip="A list of parameters for this scenario that will be JSON serialized in the configuration file."/>
<editor:PropertyField name="configuration-file-name" label="Constants File Name" binding-path="serializedConstantsFileName"/>
<VisualElement style="flex-direction: row;">
<Button name="random" text="Generate Random Seed" style="flex-grow: 1;"
tooltip="Creates a new random seed"/>
<Button name="serialize" text="Serialize To Config File" style="flex-grow: 1;"
tooltip="Serializes scenario constants and randomizer settings to a JSON configuration file"/>
<Button name="deserialize" text="Deserialize From Config File" style="flex-grow: 1;"
}
/// <summary>
/// Constructs a new uniform distribution sampler
/// Constructs a new uniform distribution sampler with the interval [min, max)
/// <param name="min">The smallest value contained within the range</param>
/// <param name="max">The largest value contained within the range</param>
/// <param name="min">The smallest value contained within the range (inclusive)</param>
/// <param name="max">The largest value contained within the range (exclusive)</param>
public UniformSampler(float min, float max)
range = new FloatRange(min, max);