本文整理汇总了C#中UnityEditor.SerializedObject类的典型用法代码示例。如果您正苦于以下问题:C# SerializedObject类的具体用法?C# SerializedObject怎么用?C# SerializedObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SerializedObject类属于UnityEditor命名空间,在下文中一共展示了SerializedObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
}
}
}
}
}
开发者ID:YaFengYi,项目名称:Unity,代码行数:31,代码来源:MissingReferencesFinder.cs
示例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;
}
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:29,代码来源:AvatarControl.cs
示例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");
}
开发者ID:CORTECHX,项目名称:Dopple,代码行数:28,代码来源:BloomAndFlaresEditor.cs
示例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");
}
开发者ID:Nortrix0,项目名称:Beyond-Equilibrium,代码行数:25,代码来源:DepthOfFieldEditor.cs
示例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();
}
}
开发者ID:LaborDayJam,项目名称:DroneHunterVR,代码行数:26,代码来源:csShurikenEffectChanger.cs
示例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();
}
}
开发者ID:1001ye-qiang,项目名称:RTP,代码行数:33,代码来源:UIButtonColorEditor.cs
示例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;
}
}
}
开发者ID:ArthurRasmusson,项目名称:UofTHacks2016,代码行数:25,代码来源:DisableBehaviourInspector.cs
示例8: OnEnable
void OnEnable()
{
srcObj = new SerializedObject(target);
strength = srcObj.FindProperty("strength");
clamp = srcObj.FindProperty("clamp");
}
开发者ID:Handwiches,项目名称:JimJam,代码行数:7,代码来源:CC_SharpenEditor.cs
示例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();
}
开发者ID:farreltr,项目名称:OneLastSunset,代码行数:35,代码来源:ConditionEditor.cs
示例10: OnEnable
void OnEnable(){
settingProfileAsset = new SerializedObject(SettingsManager.LoadMainSettings());
selectableLayerField = AssetUtility.LoadPropertyAsInt ("layerCaster", settingProfileAsset);
selectableLayerMask = AssetUtility.LoadPropertyAsInt("layerMask", settingProfileAsset);
}
开发者ID:CarsonRoscoe,项目名称:DefendAman,代码行数:7,代码来源:SettingsWindow.cs
示例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);
}
开发者ID:Gege00,项目名称:spacepuppy-unity-framework,代码行数:7,代码来源:RequireComponentInEntityHeaderDrawer.cs
示例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");
}
开发者ID:ArieLeo,项目名称:AntonovSuit,代码行数:32,代码来源:AntonovSuitProbeEditor.cs
示例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();
}
开发者ID:reinaurre,项目名称:GGJ2016,代码行数:26,代码来源:PlaygroundInspectorC.cs
示例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);
}
}
}
开发者ID:CodingDuff,项目名称:play-games-plugin-for-unity,代码行数:31,代码来源:InitializeTagsAndLayers.cs
示例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();
}
开发者ID:hiyijia,项目名称:FlyingPig,代码行数:31,代码来源:PlayHavenContentRequesterEditor.cs
示例16: OnEnable
public void OnEnable()
{
serObj = new SerializedObject (target);
sharedMaterial = serObj.FindProperty("sharedMaterial");
waterQuality = serObj.FindProperty("waterQuality");
edgeBlend = serObj.FindProperty("edgeBlend");
}
开发者ID:renanclaudino,项目名称:SoundWalker,代码行数:7,代码来源:WaterBaseEditor.cs
示例17: ScaleLegacySystems
void ScaleLegacySystems(float scaleFactor)
{
//get all emitters we need to do scaling on
ParticleEmitter[] emitters = GetComponentsInChildren<ParticleEmitter>();
//get all animators we need to do scaling on
ParticleAnimator[] animators = GetComponentsInChildren<ParticleAnimator>();
//apply scaling to emitters
foreach (ParticleEmitter emitter in emitters)
{
emitter.minSize *= scaleFactor;
emitter.maxSize *= scaleFactor;
emitter.worldVelocity *= scaleFactor;
emitter.localVelocity *= scaleFactor;
emitter.rndVelocity *= scaleFactor;
//some variables cannot be accessed through regular script, we will acces them through a serialized object
SerializedObject so = new SerializedObject(emitter);
so.FindProperty("m_Ellipsoid").vector3Value *= scaleFactor;
so.FindProperty("tangentVelocity").vector3Value *= scaleFactor;
so.ApplyModifiedProperties();
}
//apply scaling to animators
foreach (ParticleAnimator animator in animators)
{
animator.force *= scaleFactor;
animator.rndForce *= scaleFactor;
}
}
开发者ID:photoapp,项目名称:StepIntoGame,代码行数:32,代码来源:ParticleScaler.cs
示例18: UpgradeSkies
public static void UpgradeSkies()
{
Undo.RegisterSceneUndo("Upgrade Skies");
Component[] all = GameObject.FindObjectsOfType(typeof(Transform)) as Component[];
//Create a dummy game object, add a namespaced Sky to it, find its serialized script type
GameObject refObj = new GameObject("_dummy_sky");
mset.Sky refSky = refObj.AddComponent<mset.Sky>();
SerializedObject refSr = new SerializedObject(refSky);
SerializedProperty scriptType = refSr.FindProperty("m_Script");
int count = 0;
//Find all old sky objects, swap out the Sky script references to mset.Sky
for(int i=0; i<all.Length; ++i) {
GameObject obj = all[i].gameObject;
if(obj) {
Sky old = obj.GetComponent<Sky>() as Sky;
if(old != null) {
SerializedObject sr = new SerializedObject(old);
sr.CopyFromSerializedProperty(scriptType);
sr.ApplyModifiedProperties();
count++;
}
}
}
if( count == 0 ) {
EditorUtility.DisplayDialog("Done Upgrading!", "No deprecated skies found.\n\nPro Tip: Don't forget to use the \"mset\" namespace when scripting with the Sky class.", "Ok");
} else {
EditorUtility.DisplayDialog("Done Upgrading!", count + " deprecated skies found and upgraded.\n\nPro Tip: Don't forget to use the \"mset\" namespace when scripting with the Sky class.", "Ok");
}
Component.DestroyImmediate(refObj);
}
开发者ID:damard,项目名称:Unity,代码行数:32,代码来源:SkyshopUtil.cs
示例19: DrawProperty
protected SerializedProperty DrawProperty(SerializedObject obj,string propertyPath){
SerializedProperty property = obj.FindProperty (propertyPath);
if (property != null) {
EditorGUILayout.PropertyField (property);
}
return property;
}
开发者ID:AlexGam,项目名称:TowerIsland,代码行数:7,代码来源:ModuleSettingsInspector.cs
示例20: EditorLayerData
public EditorLayerData(SerializedObject manager,SerializedProperty property,string layerName,int id,bool hide){
LayerID=id;
Manager=manager;
Property=property;
LayerName=layerName;
HideFromCameras=hide;
}
开发者ID:KMarshland,项目名称:ChildrensHospitalApp,代码行数:7,代码来源:EditorLayerData.cs
注:本文中的UnityEditor.SerializedObject类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论