ExtendRealityLtd / VRTK

An example of how to use the Tilia packages to create great content with VRTK v4.
https://www.vrtk.io/
MIT License
3.69k stars 993 forks source link

VRTK_SnapDropZone's CleanHighlightObject and the validComponents array #1793

Closed Quidam2k closed 5 years ago

Quidam2k commented 6 years ago

Source of VRTK: Github Version of VRTK: 3.2.1 dated 4/29, can't figure out where to find the hash. Version of Unity3D: 2018.1.0f2 Hardware used: Oculus SDK used: Oculus & Simulator

I've found it useful to leave more scripts on my highlight objects than the ones laid out on line 997: string[] validComponents = new string[] { "Transform", "MeshFilter", "MeshRenderer", "SkinnedMeshRenderer", "VRTK_GameObjectLinker" };

Since overriding the method won't allow me to do this, I've been modifying the VRTK code directly, which is generally to be discouraged.

I suggest adding an optional parameter of this array to CleanHighlightObject:

protected virtual void CleanHighlightObject(GameObject objectToClean, string[] validComponents = null)

and a change to the code that generates it, detecting if it was supplied as a parameter

if (validComponents == null)
{
     validComponents = new string[] { "Transform", "MeshFilter", "MeshRenderer", "SkinnedMeshRenderer", "VRTK_GameObjectLinker" };
}

as doing so will allow the method to be overridden and a different set of valid components supplied when calling the base implementation.

thestonefox commented 5 years ago

Closing this as it's related to an older version of VRTK (v3.3) the master branch is now on VRTK v4. Feel free to request to reopen if the issue is still present.