protected override void OnEnable() { base.OnEnable(); _isDynamic = serializedObject.FindProperty("_isDynamic"); _target = serializedObject.FindProperty("_target"); Transform[] objs = FUtility.FindObjects<Transform>(); _paths = new List<string>(); _targetDict.Clear(); for (int i = 0; i < objs.Length; i++) { if (objs[i].parent == null) _paths.AddRange(GetTransformPath(objs[i])); } string path = _paths[_selectedNodeIndex]; if (_selectedNodeIndex < _paths.Count && _targetDict.ContainsKey(path)) _target.objectReferenceValue = _targetDict[path]; _pathNames = new GUIContent[_paths.Count]; for (int i = 0; i < _paths.Count; i++) _pathNames[i] = new GUIContent(_paths[i]); _zone = serializedObject.FindProperty("_zone"); _zones = new List<FHitZone>(FUtility.FindObjects<FHitZone>()); _zones.Sort(delegate (FHitZone a, FHitZone b) { return a.name.CompareTo(b.name); }); if (_zone.objectReferenceValue == null && _zones.Count > 0) { _selectedZoneIndex = 0; _zone.objectReferenceValue = _zones[0]; } else _selectedZoneIndex = _zones.FindIndex((select) => select.name == _zone.objectReferenceValue.name); _zoneNames = new GUIContent[_zones.Count]; for (int i = 0; i != _zones.Count; ++i) _zoneNames[i] = new GUIContent(_zones[i].Text); var staticHit = (FHitCheck)target; _sequence = serializedObject.FindProperty("_sequence"); _sequences = new List<FSequence>(FUtility.FindObjects<FSequence>()); _sequences.Remove(staticHit.Sequence); _sequences.Sort(delegate (FSequence x, FSequence y) { return x.name.CompareTo(y.name); }); if (_sequence.objectReferenceValue == null && _sequences.Count > 0) { _selectedSequenceIndex = 0; _sequence.objectReferenceValue = _sequences[0]; } else _selectedSequenceIndex = _sequences.FindIndex((select) => select.name == _sequence.objectReferenceValue.name); _sequenceNames = new GUIContent[_sequences.Count]; for (int i = 0; i != _sequences.Count; ++i) _sequenceNames[i] = new GUIContent(_sequences[i].name); serializedObject.ApplyModifiedProperties(); }
protected override void OnEnable() { base.OnEnable(); _audioEvt = (FVolumeAudioEvent)target; _source = serializedObject.FindProperty("_source"); _sources = FUtility.FindObjects <AudioSource>(); _sourceNames = new GUIContent[_sources.Length]; for (int i = 0; i < _sources.Length; i++) { _sourceNames[i] = new GUIContent(_sources[i].name); } if (_sources.Length > 0) { _source.objectReferenceValue = _sources[_selectedIndex]; } serializedObject.ApplyModifiedProperties(); }
public override void OnEnable() { base.OnEnable(); if (target == null) { DestroyImmediate(this); return; } var sequenceTrack = (FSequenceTrack)target; _ownerSequence = serializedObject.FindProperty("_ownerSequence"); _sequences = new List <FSequence>(FUtility.FindObjects <FSequence>()); _sequences.Remove(sequenceTrack.Sequence); _sequences.Sort(delegate(FSequence x, FSequence y) { return(x.name.CompareTo(y.name)); }); _selectedSequenceIndex = _sequences.FindIndex((select) => select.name == _ownerSequence.objectReferenceValue.name); _sequenceNames = new GUIContent[_sequences.Count]; for (int i = 0; i != _sequences.Count; ++i) { _sequenceNames[i] = new GUIContent(_sequences[i].name); } }