Quantcast
Channel: Latest Questions by LaireonGames
Viewing all articles
Browse latest Browse all 12

Serialized properties affecting multiple variables

$
0
0
I am hoping someone can help me since I am finding some strange but consistent behaviour with one of my editor scripts whilst selecting multiple objects. Basically if I edit one value it will change it And copy another value, that wasn't touched, into every other selected object so their values become identical (This is on the script itself, the gameobject is unaffected). For example when I edit the delay value of a group of objects it will also copy the transition time of the last selected object as well even though it wasn't edited. I have a feeling I am just doing something wrong with my editor script and the serialised properties, I have posted a redaction of it below: void OnEnable () { delay = serializedObject.FindProperty ("delay"); transitionTime = serializedObject.FindProperty("transitionTime"); } void OnInspectorGUI() { serializedObject.Update (); transitionTime.floatValue = EditorGUILayout.FloatField(new GUIContent("Transition Time", ""), transitionTime.floatValue); delay.floatValue = EditorGUILayout.FloatField(new GUIContent("Delay", ""), delay.floatValue); serializedObject.ApplyModifiedProperties (); } Cheers! Jason

Viewing all articles
Browse latest Browse all 12

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>