Skip to content

Conversation

@marc-antoine-girard
Copy link
Contributor

Description

Since I've done a lot of changes in a lot of the same files, merging had some side effects. This merges everything, makes sure that they work well together and adds a bit of cleanup. This could be the only PR to merge, while the others could be used to understand the process.

This PR merges all of the PR below:
#20 #23 #26 #27 #28

UnityReferenceProperty.objectReferenceValue = DragAndDrop.objectReferences[0];
ReferenceModeProperty.enumValueIndex = (int)ReferenceMode.Unity;
ModeValue = ReferenceMode.Unity;
PropertyValue = GetUnityObject(DragAndDrop.objectReferences[0]);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR also fixes another bug with Drag and Dropping a GameObject that contained a Component with the right interface on it.
Previously, it would take DragAndDrop.objectReferences[0], which would be a GameObject, and set it to the UnityReferenceProperty.objectReferenceValue. This would work in the inspector, but at runtime, it would throw a InvalidCastException as it would try to cast the GameObject to the interface.
The solution was simply to get the right component instead of the GameObject.

}
}

protected object PropertyValue
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This property mirrors the behaviour of SerializableInterface.Value, but in the PropertyDrawer.

@marc-antoine-girard marc-antoine-girard changed the title Merging #19 #21 #22 #24 #25 Merging #20 #23 #26 #27 #28 Jul 12, 2022
Should always check if gameObject. This will be useful later on.
@Thundernerd
Copy link
Owner

I am not a fan of this approach. I would like all changes to be separate instead of one big chunk. This makes it easier to review the PRs and also easier to review the code history at a later stage if needed. Please make sure that all the other PRs work as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants