Hi all,
Just trying to get Multi editing working in an editor script and I’m finding it pretty confusing.
So I’m using the [CanEditMultipleObjects] at the top of the editor script, then this -
SerializedProperty aSerializedCheckBox;
void OnEnable()
{
// Setup the SerializedProperties.
aSerializedCheckBox = serializedObject.FindProperty ("aCheckBox");// Find with a string? Really?
}
public override void OnInspectorGUI()
{
serializedObject.Update ();
var targetComponent = (Element2) target;
EditorGUILayout.ToggleLeft("test", aSerializedCheckBox);
I have a property called “aCheckBox” on the target script but I’m getting an error with this saying - Argument 2: cannot convert from ‘UnityEditor.SerializedProperty’ to ‘bool’
Hey do you know how you’d do something like a button?
I thought I might be able to use targets and then just get the button to apply to all of the targets.
But if I use this var targetComponents = (Element2[]) targets;
I get - InvalidCastException: Specified cast is not valid.
See the answer given by darkgaze (not the green ‘accepted’ post) in this Unity Answers thread, it shows a simple example of how to use the targets property.