コード例 #1
0
	public void DrawInspector<OCType>(OCType target)
		where OCType : new()
	{
		if(target == null)
		{
			GUILayout.Label("Object is Null");
			return;
		}

		Type exposePropertiesType =
			typeof(OCExposePropertyFieldsAttribute);

		OCExposure exposure = OCExposure.None;

		if(exposePropertiesType != null)
		{
			object[] attributes =
				target.GetType().GetCustomAttributes(exposePropertiesType, true);

			if(attributes != null && attributes.Length > 0)
				exposure = (attributes[0] as OCExposePropertyFieldsAttribute).Exposure;
		}

		SerializedProperty unityPropertyFieldIterator =
			serializedObject.GetIterator();

		List<OCPropertyField> allPropertyFields =
		OCPropertyField.GetAllPropertiesAndFields
		(
			target
		, unityPropertyFieldIterator
		, exposure
		);

		DrawSerializedProperties(allPropertyFields);

		FindMissingScripts(ref allPropertyFields);

//		OCPropertyField.SetAllPropertiesAndFields
//		(
//			target
//		, allPropertyFields
//		);

	}
            /////////////////////////////////////////////////////////////////////////////

            #endregion

            /////////////////////////////////////////////////////////////////////////////

            #region Public Member Functions

            /////////////////////////////////////////////////////////////////////////////

            public OCExposePropertyFieldsAttribute
                (OCExposure exposure = OCExposure.PropertiesAndFields)
            {
                m_Exposure = exposure;
            }