本文整理汇总了C#中UnityEditor.SerializedObject.FindProperty方法的典型用法代码示例。如果您正苦于以下问题:C# SerializedObject.FindProperty方法的具体用法?C# SerializedObject.FindProperty怎么用?C# SerializedObject.FindProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEditor.SerializedObject
的用法示例。
在下文中一共展示了SerializedObject.FindProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnEnable
void OnEnable()
{
serObj = new SerializedObject(target);
bloomIntensity = serObj.FindProperty("bloomIntensity");
lensDirtIntensity = serObj.FindProperty("lensDirtIntensity");
lensDirtTexture = serObj.FindProperty("lensDirtTexture");
}
示例2: DoVariable
private void DoVariable(FsmVariable variable){
SerializedObject serializedObject = new SerializedObject (variable);
SerializedProperty nameProperty = serializedObject.FindProperty ("name");
SerializedProperty valueProperty = serializedObject.FindProperty ("value");
GUILayout.BeginHorizontal ();
serializedObject.Update ();
EditorGUILayout.PropertyField(nameProperty,GUIContent.none);
if (valueProperty != null) {
if (valueProperty.propertyType == SerializedPropertyType.Boolean) {
EditorGUILayout.PropertyField (valueProperty, GUIContent.none, GUILayout.Width (17));
} else {
EditorGUILayout.PropertyField (valueProperty, GUIContent.none);
}
}
serializedObject.ApplyModifiedProperties ();
GUILayout.FlexibleSpace ();
if (GUILayout.Button (FsmEditorStyles.toolbarMinus,FsmEditorStyles.label)) {
FsmEditor.Root.Variables=ArrayUtility.Remove<FsmVariable>(FsmEditor.Root.Variables,variable);
UnityEngine.Object.DestroyImmediate(variable,true);
AssetDatabase.SaveAssets();
}
GUILayout.EndHorizontal ();
}
示例3: Apply
internal override void Apply()
{
MappingRelevantSettings[] sourceArray = new MappingRelevantSettings[base.targets.Length];
for (int i = 0; i < base.targets.Length; i++)
{
SerializedObject obj2 = new SerializedObject(base.targets[i]);
SerializedProperty property = obj2.FindProperty("m_AnimationType");
SerializedProperty property2 = obj2.FindProperty("m_CopyAvatar");
sourceArray[i].humanoid = property.intValue == 3;
sourceArray[i].hasNoAnimation = property.intValue == 0;
sourceArray[i].copyAvatar = property2.boolValue;
}
MappingRelevantSettings[] destinationArray = new MappingRelevantSettings[base.targets.Length];
Array.Copy(sourceArray, destinationArray, base.targets.Length);
for (int j = 0; j < base.targets.Length; j++)
{
if (!this.m_AnimationType.hasMultipleDifferentValues)
{
destinationArray[j].humanoid = this.m_AnimationType.intValue == 3;
}
if (!this.m_CopyAvatar.hasMultipleDifferentValues)
{
destinationArray[j].copyAvatar = this.m_CopyAvatar.boolValue;
}
}
base.serializedObject.ApplyModifiedProperties();
for (int k = 0; k < base.targets.Length; k++)
{
if (sourceArray[k].usesOwnAvatar && !destinationArray[k].usesOwnAvatar)
{
SerializedObject serializedObject = new SerializedObject(base.targets[k]);
AvatarSetupTool.ClearAll(serializedObject);
serializedObject.ApplyModifiedProperties();
}
if (!sourceArray[k].usesOwnAvatar && destinationArray[k].usesOwnAvatar)
{
ModelImporter importer = base.targets[k] as ModelImporter;
if (sourceArray[k].hasNoAnimation)
{
AssetDatabase.ImportAsset(importer.assetPath);
}
SerializedObject modelImporterSerializedObject = new SerializedObject(base.targets[k]);
GameObject original = AssetDatabase.LoadMainAssetAtPath(importer.assetPath) as GameObject;
Animator component = original.GetComponent<Animator>();
bool flag = (component != null) && !component.hasTransformHierarchy;
if (flag)
{
original = UnityEngine.Object.Instantiate<GameObject>(original);
AnimatorUtility.DeoptimizeTransformHierarchy(original);
}
AvatarSetupTool.AutoSetupOnInstance(original, modelImporterSerializedObject);
this.m_IsBiped = AvatarBipedMapper.IsBiped(original.transform);
if (flag)
{
UnityEngine.Object.DestroyImmediate(original);
}
modelImporterSerializedObject.ApplyModifiedProperties();
}
}
}
示例4: OnEnable
public void OnEnable(SerializedObject serializedObject)
{
this.m_WidthMultiplier = serializedObject.FindProperty("m_Parameters.widthMultiplier");
this.m_WidthCurve = serializedObject.FindProperty("m_Parameters.widthCurve");
this.m_Settings.hRangeMin = 0f;
this.m_Settings.vRangeMin = 0f;
this.m_Settings.vRangeMax = 1f;
this.m_Settings.hRangeMax = 1f;
this.m_Settings.vSlider = false;
this.m_Settings.hSlider = false;
TickStyle style = new TickStyle {
tickColor = { color = new Color(0f, 0f, 0f, 0.15f) },
distLabel = 30
};
this.m_Settings.hTickStyle = style;
TickStyle style2 = new TickStyle {
tickColor = { color = new Color(0f, 0f, 0f, 0.15f) },
distLabel = 20
};
this.m_Settings.vTickStyle = style2;
this.m_Settings.undoRedoSelection = true;
this.m_Editor = new CurveEditor(new Rect(0f, 0f, 1000f, 100f), new CurveWrapper[0], false);
this.m_Editor.settings = this.m_Settings;
this.m_Editor.margin = 25f;
this.m_Editor.SetShownHRangeInsideMargins(0f, 1f);
this.m_Editor.SetShownVRangeInsideMargins(0f, 1f);
this.m_Editor.ignoreScrollWheelUntilClicked = true;
Undo.undoRedoPerformed = (Undo.UndoRedoCallback) Delegate.Combine(Undo.undoRedoPerformed, new Undo.UndoRedoCallback(this.UndoRedoPerformed));
}
示例5: OnInspectorGUI
public override void OnInspectorGUI()
{
SerializedObject myScript = new SerializedObject(target);
SerializedProperty SpawnGameObject = myScript.FindProperty("SpawnGameObject");
SerializedProperty SpawnTime = myScript.FindProperty("SpawnTime");
SerializedProperty DependOnThisState = myScript.FindProperty("DependOnThisState");
SerializedProperty DestroyTime = myScript.FindProperty("DestroyTime");
SerializedProperty OffsetDueDirection = myScript.FindProperty("OffsetDueDirection");
EditorGUILayout.Space(); EditorGUILayout.Space();
SpawnGameObject.objectReferenceValue =
EditorGUILayout.ObjectField(new GUIContent("Spawn Game Object"), SpawnGameObject.objectReferenceValue, typeof(GameObject), true) as GameObject;
if (SpawnGameObject.objectReferenceValue == null) {
EditorGUILayout.HelpBox(_spawnError, MessageType.Error);
}
EditorGUILayout.Slider(SpawnTime, 0.0f, 1.0f, new GUIContent("Spawn Time (%)"));
EditorGUILayout.Space(); EditorGUILayout.Space();
EditorGUILayout.PropertyField(DependOnThisState);
if (DependOnThisState.boolValue) {
EditorGUILayout.Slider(DestroyTime, 0.0f, 1.0f, new GUIContent("Destroy Time (%)"));
}
EditorGUILayout.Space(); EditorGUILayout.Space();
EditorGUILayout.LabelField("Player Base Setup", EditorStyles.boldLabel);
EditorGUILayout.HelpBox(_offsetDueDirectionInfo, MessageType.Info);
EditorGUILayout.PropertyField(OffsetDueDirection);
myScript.ApplyModifiedProperties();
}
示例6: OnEnable
void OnEnable()
{
playerId = serializedObject.FindProperty("playerId");
bodyTrackingDevice = serializedObject.FindProperty("bodyTrackingDevice");
// gestureSelectionMethod = serializedObject.FindProperty("gestureSelectionMethod");
wandStart = serializedObject.FindProperty("wandStart");
wandEnd = serializedObject.FindProperty("wandEnd");
rotationNoiseCovariance = serializedObject.FindProperty("rotationNoiseCovariance");
visualizerThreshold = serializedObject.FindProperty("visualizerThreshold");
visualizerWidth = serializedObject.FindProperty("visualizerWidth");
visualizerHeight = serializedObject.FindProperty("visualizerHeight");
wandColor = serializedObject.FindProperty("wandColor");
// gestureRecognizer = serializedObject.FindProperty("gestureRecognizer");
wandPositionVisualizer = serializedObject.FindProperty("wandPositionVisualizer");
showVisualizer = serializedObject.FindProperty("showVisualizer");
switchToAvailableKinect = serializedObject.FindProperty("switchToAvailableKinect");
skeletonWand = target as RUISSkeletonWand;
if(skeletonWand) {
gestureSelectionMethodLink = new SerializedObject(skeletonWand);
guiGestureSelectionMethodChoiceLink = gestureSelectionMethodLink.FindProperty("gestureSelectionMethod");
gestureScriptLink = gestureSelectionMethodLink.FindProperty("gestureSelectionScriptName");
}
}
示例7: LegacyEffectScaleChange
public void LegacyEffectScaleChange(float Value)
{
ParticleEmitter[] ParticleEmitters = GetComponentsInChildren<ParticleEmitter>();
ParticleAnimator[] ParticleAnimators = GetComponentsInChildren<ParticleAnimator>();
ParticleRenderer[] ParticleRenderers = GetComponentsInChildren<ParticleRenderer>();
transform.localScale *= Value;
foreach (ParticleEmitter _ParticleEmitter in ParticleEmitters)
{
_ParticleEmitter.minSize *= Value;
_ParticleEmitter.maxSize *= Value;
_ParticleEmitter.localVelocity *= Value;
_ParticleEmitter.rndAngularVelocity *= Value;
_ParticleEmitter.rndVelocity *= Value;
SerializedObject _SerializedObject = new SerializedObject(_ParticleEmitter);
_SerializedObject.FindProperty("m_Ellipsoid").vector3Value *= Value;
_SerializedObject.FindProperty("tangentVelocity").vector3Value *= Value;
_SerializedObject.ApplyModifiedProperties();
}
foreach (ParticleAnimator _ParticleAnimator in ParticleAnimators)
{
_ParticleAnimator.sizeGrow *= Value;
_ParticleAnimator.force *= Value;
_ParticleAnimator.rndForce *= Value;
}
foreach (ParticleRenderer _ParticleRenderer in ParticleRenderers)
{
_ParticleRenderer.maxParticleSize *= Value;
}
}
示例8: OnEnable
void OnEnable()
{
srcObj = new SerializedObject(target);
rampTexture = srcObj.FindProperty("rampTexture");
amount = srcObj.FindProperty("amount");
}
示例9: OnEnable
void OnEnable()
{
t = (IpcIrcEventHandler)target;
GetTarget = new SerializedObject(t);
ThisString = GetTarget.FindProperty("triggerPhrase"); // Find the triggerphrase string
ThisList = GetTarget.FindProperty("myEventList"); // Find the List in our script and create a refrence of it
}
示例10: DrawInspector
// ===========================================================
// Static Methods
// ===========================================================
public static void DrawInspector(SerializedObject so) {
so.Update();
var mode = so.FindProperty("mode");
var position = so.FindProperty("position");
var anchorObject = so.FindProperty("anchorObject");
var anchorCamera = so.FindProperty("anchorCamera");
MadGUI.PropertyField(mode, "Mode");
switch ((MadAnchor.Mode) mode.enumValueIndex) {
case MadAnchor.Mode.ObjectAnchor:
MadGUI.PropertyField(anchorObject, "Anchor Object", MadGUI.ObjectIsSet);
MadGUI.PropertyField(anchorCamera, "Anchor Camera", property => property.objectReferenceValue != null || HasMainCamera());
if (!HasMainCamera()) {
GUIMissingMainCameraWarning();
} else if (anchorCamera.objectReferenceValue == null) {
GUIMainCameraWillBeUsed();
}
break;
case MadAnchor.Mode.ScreenAnchor:
MadGUI.PropertyField(position, "Position");
break;
default:
MadDebug.Assert(false, "Unknown mode: " + (MadAnchor.Mode) mode.enumValueIndex);
break;
}
so.ApplyModifiedProperties();
}
示例11: OnEnable
// Use this for initialization
void OnEnable()
{
waypoint = new SerializedObject(target);
lanesCount = waypoint.FindProperty("waypointsCount");
laneid = waypoint.FindProperty("pathID");
objectsCount = (GameObject.FindObjectOfType(typeof(Lane)) as Lane).gameObject.GetComponentsInChildren<WayPoint>().Length;
}
示例12: OnGUI
void OnGUI()
{
m_Type = (ItemType)EditorGUILayout.EnumPopup("Item Type", m_Type);
m_strName = EditorGUILayout.TextField("Name", m_strName);
m_strDescription = EditorGUILayout.TextField("Description", m_strDescription);
ScriptableObject target = this;
SerializedObject so = new SerializedObject(target);
SerializedProperty sp_picNames = so.FindProperty("m_strPicNames");
SerializedProperty sp_childItems = so.FindProperty("m_iChildItems");
EditorGUILayout.PropertyField(sp_picNames, true);
EditorGUILayout.PropertyField(sp_childItems, true);
so.ApplyModifiedProperties();
if (GUILayout.Button("Create"))
{
ItemInfo info = new ItemInfo();
info.m_iID = 0;
info.m_Type = m_Type;
info.m_strName = m_strName;
info.m_strDescription = m_strDescription;
info.m_iPhotoIDs = m_iPhotoIDs;
info.m_iChildIDs = m_iChildIDs;
WriteItemInfo(info);
}
}
示例13: OnInspectorGUI
public override void OnInspectorGUI()
{
aap = serializedObject;
SerializedProperty movementActions = aap.FindProperty ("actions");
SerializedProperty fireTags = aap.FindProperty ("fireTags");
SerializedProperty bulletTags = aap.FindProperty ("bulletTags");
DanmakuEditorUtils.AttackPatternPropertiesGUI (aap);
if(EditorGUILayout.PropertyField (movementActions, new GUIContent("Movement Pattern")))
{
CommonActionDrawer.attackPattern = target as ActionAttackPattern;
DanmakuEditorUtils.ActionGroupField(movementActions, this, true);
}
if(EditorGUILayout.PropertyField (fireTags))
{
CommonActionDrawer.attackPattern = target as ActionAttackPattern;
DanmakuEditorUtils.TagGroupField(fireTags, this, false);
}
if(EditorGUILayout.PropertyField (bulletTags))
{
CommonActionDrawer.attackPattern = target as ActionAttackPattern;
DanmakuEditorUtils.TagGroupField(bulletTags, this, false);
}
aap.ApplyModifiedProperties ();
}
示例14: OnEnable
public void OnEnable () {
serObj = new SerializedObject (target);
reflectionMask = serObj.FindProperty("reflectionMask");
reflectSkybox = serObj.FindProperty("reflectSkybox");
clearColor = serObj.FindProperty("clearColor");
}
示例15: OnEnable
void OnEnable()
{
srcObj = new SerializedObject(target);
scale = srcObj.FindProperty("scale");
brightness = srcObj.FindProperty("brightness");
}