本文整理汇总了C#中UnityEditor.SerializedObject类的典型用法代码示例。如果您正苦于以下问题:C# SerializedObject类的具体用法?C# SerializedObject怎么用?C# SerializedObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SerializedObject类属于UnityEditor命名空间,在下文中一共展示了SerializedObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindMissingReferences
private static void FindMissingReferences(string context, GameObject[] objects)
{
foreach (var go in objects)
{
var components = go.GetComponents<Component>();
foreach (var c in components)
{
if (!c)
{
Debug.LogError("Missing Component in GO: " + FullPath(go), go);
continue;
}
SerializedObject so = new SerializedObject(c);
var sp = so.GetIterator();
while (sp.NextVisible(true))
{
if (sp.propertyType == SerializedPropertyType.ObjectReference)
{
if (sp.objectReferenceValue == null
&& sp.objectReferenceInstanceIDValue != 0)
{
ShowError(context, go, c.GetType().Name, ObjectNames.NicifyVariableName(sp.name));
}
}
}
}
}
}
示例2: ShowBoneMapping
public static int ShowBoneMapping(int shownBodyView, AvatarControl.BodyPartFeedback bodyPartCallback, AvatarSetupTool.BoneWrapper[] bones, SerializedObject serializedObject, AvatarMappingEditor editor)
{
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if ((bool) ((Object) AvatarControl.styles.Silhouettes[shownBodyView].image))
{
Rect rect = GUILayoutUtility.GetRect(AvatarControl.styles.Silhouettes[shownBodyView], GUIStyle.none, new GUILayoutOption[1]{ GUILayout.MaxWidth((float) AvatarControl.styles.Silhouettes[shownBodyView].image.width) });
AvatarControl.DrawBodyParts(rect, shownBodyView, bodyPartCallback);
for (int i = 0; i < bones.Length; ++i)
AvatarControl.DrawBone(shownBodyView, i, rect, bones[i], serializedObject, editor);
}
else
GUILayout.Label("texture missing,\nfix me!");
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
Rect lastRect = GUILayoutUtility.GetLastRect();
string[] strArray = new string[4]{ "Body", "Head", "Left Hand", "Right Hand" };
lastRect.x += 5f;
lastRect.width = 70f;
lastRect.yMin = lastRect.yMax - 69f;
lastRect.height = 16f;
for (int index = 0; index < strArray.Length; ++index)
{
if (GUI.Toggle(lastRect, shownBodyView == index, strArray[index], EditorStyles.miniButton))
shownBodyView = index;
lastRect.y += 16f;
}
return shownBodyView;
}
示例3: OnEnable
void OnEnable () {
serObj = new SerializedObject (target);
screenBlendMode = serObj.FindProperty("screenBlendMode");
hdr = serObj.FindProperty("hdr");
sepBlurSpread = serObj.FindProperty("sepBlurSpread");
useSrcAlphaAsMask = serObj.FindProperty("useSrcAlphaAsMask");
bloomIntensity = serObj.FindProperty("bloomIntensity");
bloomthreshold = serObj.FindProperty("bloomThreshold");
bloomBlurIterations = serObj.FindProperty("bloomBlurIterations");
lensflares = serObj.FindProperty("lensflares");
lensflareMode = serObj.FindProperty("lensflareMode");
hollywoodFlareBlurIterations = serObj.FindProperty("hollywoodFlareBlurIterations");
hollyStretchWidth = serObj.FindProperty("hollyStretchWidth");
lensflareIntensity = serObj.FindProperty("lensflareIntensity");
lensflarethreshold = serObj.FindProperty("lensflareThreshold");
flareColorA = serObj.FindProperty("flareColorA");
flareColorB = serObj.FindProperty("flareColorB");
flareColorC = serObj.FindProperty("flareColorC");
flareColorD = serObj.FindProperty("flareColorD");
lensFlareVignetteMask = serObj.FindProperty("lensFlareVignetteMask");
tweakMode = serObj.FindProperty("tweakMode");
}
示例4: OnEnable
void OnEnable()
{
serObj = new SerializedObject (target);
visualizeFocus = serObj.FindProperty ("visualizeFocus");
focalLength = serObj.FindProperty ("focalLength");
focalSize = serObj.FindProperty ("focalSize");
aperture = serObj.FindProperty ("aperture");
focalTransform = serObj.FindProperty ("focalTransform");
maxBlurSize = serObj.FindProperty ("maxBlurSize");
highResolution = serObj.FindProperty ("highResolution");
blurType = serObj.FindProperty ("blurType");
blurSampleCount = serObj.FindProperty ("blurSampleCount");
nearBlur = serObj.FindProperty ("nearBlur");
foregroundOverlap = serObj.FindProperty ("foregroundOverlap");
dx11BokehThreshold = serObj.FindProperty ("dx11BokehThreshold");
dx11SpawnHeuristic = serObj.FindProperty ("dx11SpawnHeuristic");
dx11BokehTexture = serObj.FindProperty ("dx11BokehTexture");
dx11BokehScale = serObj.FindProperty ("dx11BokehScale");
dx11BokehIntensity = serObj.FindProperty ("dx11BokehIntensity");
}
示例5: ShurikenParticleScaleChange
public void ShurikenParticleScaleChange(float _Value)
{
ParticleSystem[] ParticleSystems = GetComponentsInChildren<ParticleSystem>();
transform.localScale *= _Value;
foreach(ParticleSystem _ParticleSystem in ParticleSystems) {
_ParticleSystem.startSpeed *= _Value;
_ParticleSystem.startSize *= _Value;
_ParticleSystem.gravityModifier *= _Value;
SerializedObject _SerializedObject = new SerializedObject(_ParticleSystem);
_SerializedObject.FindProperty("CollisionModule.particleRadius").floatValue *= _Value;
_SerializedObject.FindProperty("ShapeModule.radius").floatValue *= _Value;
_SerializedObject.FindProperty("ShapeModule.boxX").floatValue *= _Value;
_SerializedObject.FindProperty("ShapeModule.boxY").floatValue *= _Value;
_SerializedObject.FindProperty("ShapeModule.boxZ").floatValue *= _Value;
_SerializedObject.FindProperty("VelocityModule.x.scalar").floatValue *= _Value;
_SerializedObject.FindProperty("VelocityModule.y.scalar").floatValue *= _Value;
_SerializedObject.FindProperty("VelocityModule.z.scalar").floatValue *= _Value;
_SerializedObject.FindProperty("ClampVelocityModule.x.scalar").floatValue *= _Value;
_SerializedObject.FindProperty("ClampVelocityModule.y.scalar").floatValue *= _Value;
_SerializedObject.FindProperty("ClampVelocityModule.z.scalar").floatValue *= _Value;
_SerializedObject.FindProperty("ClampVelocityModule.magnitude.scalar").floatValue *= _Value;
_SerializedObject.ApplyModifiedProperties();
}
}
示例6: DrawColors
protected void DrawColors ()
{
if (serializedObject.FindProperty("tweenTarget").objectReferenceValue == null) return;
if (NGUIEditorTools.DrawHeader("Colors", "Colors", false, true))
{
NGUIEditorTools.BeginContents(true);
NGUIEditorTools.SetLabelWidth(76f);
UIButtonColor btn = target as UIButtonColor;
if (btn.tweenTarget != null)
{
UIWidget widget = btn.tweenTarget.GetComponent<UIWidget>();
if (widget != null)
{
EditorGUI.BeginDisabledGroup(serializedObject.isEditingMultipleObjects);
{
SerializedObject obj = new SerializedObject(widget);
obj.Update();
NGUIEditorTools.DrawProperty("Normal", obj, "mColor");
obj.ApplyModifiedProperties();
}
EditorGUI.EndDisabledGroup();
}
}
NGUIEditorTools.DrawProperty("Hover", serializedObject, "hover");
NGUIEditorTools.DrawProperty("Pressed", serializedObject, "pressed");
NGUIEditorTools.DrawProperty("Disabled", serializedObject, "disabledColor");
NGUIEditorTools.EndContents();
}
}
示例7: OnEnable
public void OnEnable()
{
disableBehaviour = new SerializedObject(this.target);
this.fireTime = disableBehaviour.FindProperty("firetime");
this.componentsProperty = disableBehaviour.FindProperty("Behaviour");
this.editorRevert = disableBehaviour.FindProperty("editorRevertMode");
this.runtimeRevert = disableBehaviour.FindProperty("runtimeRevertMode");
Component currentComponent = componentsProperty.objectReferenceValue as Component;
DisableBehaviour behaviour = (target as DisableBehaviour);
if (behaviour == null || behaviour.ActorTrackGroup == null || behaviour.ActorTrackGroup.Actor == null)
{
return;
}
GameObject actor = behaviour.ActorTrackGroup.Actor.gameObject;
Component[] behaviours = DirectorHelper.getEnableableComponents(actor);
for (int j = 0; j < behaviours.Length; j++)
{
if (behaviours[j] == currentComponent)
{
componentSelection = j;
}
}
}
示例8: OnEnable
void OnEnable()
{
srcObj = new SerializedObject(target);
strength = srcObj.FindProperty("strength");
clamp = srcObj.FindProperty("clamp");
}
示例9: Draw
public void Draw(Condition condition, SerializedObject serializedObject)
{
foldout = EditorGUILayout.Foldout(foldout, "Condition Editor");
if (!foldout || (serializedObject == null)) return;
serializedObject.Update();
if (drawReferenceDatabase) {
EditorTools.selectedDatabase = EditorGUILayout.ObjectField(new GUIContent("Reference Database", "Database to use for Lua and Quest conditions"), EditorTools.selectedDatabase, typeof(DialogueDatabase), true) as DialogueDatabase;
}
luaConditionWizard.database = EditorTools.selectedDatabase;
if (luaConditionWizard.database != null) {
if (!luaConditionWizard.IsOpen) {
luaConditionWizard.OpenWizard(string.Empty);
}
currentLuaWizardContent = luaConditionWizard.Draw(new GUIContent("Lua Condition Wizard", "Use to add Lua conditions below"), currentLuaWizardContent, false);
if (!luaConditionWizard.IsOpen && !string.IsNullOrEmpty(currentLuaWizardContent)) {
List<string> luaList = new List<string>(condition.luaConditions);
luaList.Add(currentLuaWizardContent);
condition.luaConditions = luaList.ToArray();
currentLuaWizardContent = string.Empty;
luaConditionWizard.OpenWizard(string.Empty);
}
}
EditorWindowTools.StartIndentedSection();
SerializedProperty conditions = serializedObject.FindProperty("condition");
EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(conditions, true);
if (EditorGUI.EndChangeCheck()) serializedObject.ApplyModifiedProperties();
EditorWindowTools.EndIndentedSection();
}
示例10: OnEnable
void OnEnable(){
settingProfileAsset = new SerializedObject(SettingsManager.LoadMainSettings());
selectableLayerField = AssetUtility.LoadPropertyAsInt ("layerCaster", settingProfileAsset);
selectableLayerMask = AssetUtility.LoadPropertyAsInt("layerMask", settingProfileAsset);
}
示例11: Validate
private bool Validate(SerializedObject serializedObject, out System.Type missingComponentType)
{
var c = serializedObject.targetObject as Component;
missingComponentType = null;
if (c == null) return true;
return !com.spacepuppy.Utils.Assertions.AssertRequireComponentInEntityAttrib(c, out missingComponentType, true);
}
示例12: OnEnable
void OnEnable()
{
m_target = (AntonovSuitProbe)target;
m_AntonovSuitProbe = new SerializedObject(target);
m_cubemapRadius = m_AntonovSuitProbe.FindProperty("probeRadius");
m_cubemapBoxSize = m_AntonovSuitProbe.FindProperty("probeBoxSize");
m_diffuseSamples = m_AntonovSuitProbe.FindProperty("diffuseSamples");
m_specularSamples = m_AntonovSuitProbe.FindProperty("specularSamples");
m_cubemapFolder = m_AntonovSuitProbe.FindProperty("cubemapFolder");
m_cubemapName = m_AntonovSuitProbe.FindProperty("cubemapName");
m_diffuseSize = m_AntonovSuitProbe.FindProperty("diffuseSize");
m_specularSize = m_AntonovSuitProbe.FindProperty("specularSize");
m_smoothEdge = m_AntonovSuitProbe.FindProperty("smoothEdge");
//m_edgeScale = m_AntonovSuitProbe.FindProperty("edgeScale");
m_Meshes = m_AntonovSuitProbe.FindProperty("Meshes");
m_irradianceModel = m_AntonovSuitProbe.FindProperty("irradianceModel");
m_radianceModel = m_AntonovSuitProbe.FindProperty("radianceModel");
m_projectionType = m_AntonovSuitProbe.FindProperty("typeOfProjection");
m_atten = m_AntonovSuitProbe.FindProperty("useAtten");
m_attenRadius = m_AntonovSuitProbe.FindProperty("attenSphereRadius");
m_attenBoxSize = m_AntonovSuitProbe.FindProperty("attenBoxSize");
m_diffuseExposure = m_AntonovSuitProbe.FindProperty("diffuseExposure");
m_specularExposure = m_AntonovSuitProbe.FindProperty("specularExposure");
//m_bakeDirectAndIBL = m_AntonovSuitProbe.FindProperty("bakeDirectAndIBL");
}
示例13: Initialize
public static void Initialize (PlaygroundC targetRef) {
playgroundScriptReference = targetRef;
PlaygroundC.reference = targetRef;
if (playgroundScriptReference==null) return;
playground = new SerializedObject(playgroundScriptReference);
particleSystems = playground.FindProperty("particleSystems");
manipulators = playground.FindProperty("manipulators");
calculate = playground.FindProperty("calculate");
pixelFilterMode = playground.FindProperty("pixelFilterMode");
autoGroup = playground.FindProperty("autoGroup");
buildZeroAlphaPixels = playground.FindProperty("buildZeroAlphaPixels");
drawGizmos = playground.FindProperty("drawGizmos");
drawSourcePositions = playground.FindProperty("drawSourcePositions");
drawWireframe = playground.FindProperty("drawWireframe");
drawSplinePreview = playground.FindProperty("drawSplinePreview");
paintToolbox = playground.FindProperty("paintToolbox");
showShuriken = playground.FindProperty("showShuriken");
showSnapshots = playground.FindProperty("showSnapshotsInHierarchy");
threads = playground.FindProperty("threadMethod");
threadsTurbulence = playground.FindProperty("turbulenceThreadMethod");
threadsSkinned = playground.FindProperty("skinnedMeshThreadMethod");
maxThreads = playground.FindProperty("maxThreads");
playgroundSettings = PlaygroundSettingsC.GetReference();
playgroundLanguage = PlaygroundSettingsC.GetLanguage();
}
示例14: CheckTags
/// <summary>
/// Checks the tags to make sure they are defined.
/// </summary>
/// <param name="tagManager">Tag manager.</param>
private static void CheckTags(SerializedObject tagManager)
{
SerializedProperty tagsProp = tagManager.FindProperty("tags");
for (int index = 0; index < requiredTags.Length; index++)
{
string tag = requiredTags[index];
bool found = false;
for (int i = 0; i < tagsProp.arraySize; i++)
{
SerializedProperty t = tagsProp.GetArrayElementAtIndex(i);
if (t.stringValue == tag)
{
found = true;
break;
}
}
if (!found)
{
tagsProp.InsertArrayElementAtIndex(0);
SerializedProperty n = tagsProp.GetArrayElementAtIndex(0);
n.stringValue = tag;
Debug.Log("Adding tag: " + tag);
}
}
}
示例15: OnEnable
protected override void OnEnable()
{
base.OnEnable();
requester = new SerializedObject(target);
whenToRequest = requester.FindProperty("whenToRequest");
placement = requester.FindProperty("placement");
showsOverlayImmediately = requester.FindProperty("showsOverlayImmediately");
rewardMayBeDelivered = requester.FindProperty("rewardMayBeDelivered");
rewardMessageType = requester.FindProperty("rewardMessageType");
requestDelay = requester.FindProperty("requestDelay");
limitedUse = requester.FindProperty("limitedUse");
maxUses = requester.FindProperty("maxUses");
exhaustAction = requester.FindProperty("exhaustAction");
useDefaultTestReward = requester.FindProperty("useDefaultTestReward");
defaultTestRewardName = requester.FindProperty("defaultTestRewardName");
defaultTestRewardQuantity = requester.FindProperty("defaultTestRewardQuantity");
prefetch = requester.FindProperty("prefetch");
refetchWhenUsed = requester.FindProperty("refetchWhenUsed");
connectionForPrefetch = requester.FindProperty("connectionForPrefetch");
//pauseGameWhenDisplayed = serializedObject.FindProperty("pauseGameWhenDisplayed");
originalBackgroundColor = GUI.backgroundColor;
delayRequest = requestDelay.floatValue >= DELAY_MIN;
// settings
settings = PlayHavenSettings.Get();
RefreshPlacementList();
RefreshRewardsList();
}