Unity-Technologies / guid-based-reference

A component for giving Game Objects a GUID and a class to create references to objects in any Scene by GUID
Other
625 stars 71 forks source link

An method for setting GuidReference target object from editor tools could be useful #9

Open schmid opened 5 years ago

schmid commented 5 years ago

Adding this to GuidReference.cs is useful for editor tools:

#if UNITY_EDITOR
    public void SetReferenceEditor(MonoBehaviour behaviourWithReference, GuidComponent target)
    {
        Undo.RecordObject(behaviourWithReference, "Set GUID Reference");
        guid = target.GetGuid();
    }
#endif