static internal void GetProperties(this PEModifications.PropertyData _this, out SerializedProperty prefabProperty, out SerializedProperty objectProperty, PEPrefabScript script)
        {
            var couple = _this.UserData as PropertyCouple;

            if (couple == null)
            {
                couple = new PropertyCouple();
                if (couple.objectProperty == null)
                {
                    var so = new SerializedObject(_this.Object);

                    if (so != null)
                    {
                        couple.objectProperty = so.FindProperty(_this.PropertyPath);
                    }

                    if (couple.objectProperty == null)
                    {
                        if (PEPrefs.DebugLevel > 0)
                        {
                            Debug.Log(string.Format("Property {0} not found on Object {1}", _this.PropertyPath, _this.Object));
                        }
                    }
                }

                if (couple.prefabProperty == null)
                {
                    var prefabObject = script.Links.GetPrefabObject(script.GetDiffWith().gameObject, _this.Object);

                    if (prefabObject != null)
                    {
                        var so = new SerializedObject(prefabObject);
                        if (so != null)
                        {
                            couple.prefabProperty = so.FindProperty(_this.PropertyPath);
                        }
                    }
                    else
                    {
                        Debug.LogWarning("Prefab object for prefab property modifications is not found");
                    }
                }
            }

            prefabProperty = couple.prefabProperty;
            objectProperty = couple.objectProperty;
            _this.UserData = couple;
        }
Beispiel #2
0
		static internal void GetProperties(this PEModifications.PropertyData _this, out SerializedProperty prefabProperty, out SerializedProperty objectProperty, PEPrefabScript script)
		{
			var couple = _this.UserData as PropertyCouple;
			if (couple == null)
			{
				couple = new PropertyCouple();
				if (couple.objectProperty == null)
				{
					var so = new SerializedObject(_this.Object);

					if (so != null)
						couple.objectProperty = so.FindProperty(_this.PropertyPath);

					if (couple.objectProperty == null)
					{
						if (PEPrefs.DebugLevel > 0)
							Debug.Log(string.Format("Property {0} not found on Object {1}", _this.PropertyPath, _this.Object));
					}
				}

				if (couple.prefabProperty == null)
				{
					var prefabObject = script.Links.GetPrefabObject(script.GetDiffWith().gameObject, _this.Object);

					if (prefabObject != null)
					{
						var so = new SerializedObject(prefabObject);
						if (so != null)
							couple.prefabProperty = so.FindProperty(_this.PropertyPath);
					}
					else
					{
						Debug.LogWarning("Prefab object for prefab property modifications is not found");
					}
				}
			}

			prefabProperty = couple.prefabProperty;
			objectProperty = couple.objectProperty;
			_this.UserData = couple;
		}