public SharedCrusherBase(ShareByCommon sharedBy) { this.shareBy = (SharedCrusherDefine.ShareBy)sharedBy; GetCallerTypeAndFieldName(); switch (this.shareBy) { case SharedCrusherDefine.ShareBy.ComponentAndFieldName: hashcode = (type.FullName + fieldname).GetHashCode(); return; case SharedCrusherDefine.ShareBy.FieldName: hashcode = fieldname.GetHashCode(); return; /// Prefabs can't immediately register with the SharedCrusherSO since they need to get their instanceId from the component, /// and StackTrace doesn't get us that. We get the instanceId from the Editor OnGui update. case SharedCrusherDefine.ShareBy.Prefab: return; default: UnityEngine.Debug.LogError("Invalid Enum value."); return; } }
/// <summary> /// Constructor that uses StackTrace and SerializedProperty to determined which instances are common and should share a crusher instance. /// \nPrefab : All instances of a prefab will share a crusher instance. /// \nFieldName : All crushers with this same field name will share a crusher instance, even across components and scenes. /// \nComponent and FieldName : All instances of this component will share a common crusher for this field. /// </summary> /// <param name="shareBy"></param> public SharedTransformCrusher(ShareByCommon shareBy = ShareByCommon.Prefab) : base(shareBy) { }
/// <summary> /// Constructor that uses StackTrace and SerializedProperty to determined which instances are common and should share a crusher instance. /// \nPrefab : All instances of a prefab will share a crusher instance. /// \nFieldName : All crushers with this same field name will share a crusher instance, even across components and scenes. /// \nComponent and FieldName : All instances of this component will share a common crusher for this field. /// </summary> public SharedFloatCrusher(ShareByCommon shareBy = ShareByCommon.Prefab) : base(shareBy) { }
/// <summary> /// Constructor that uses StackTrace and SerializedProperty to determined which instances are common and should share a crusher instance. /// \nPrefab : All instances of a prefab will share a crusher instance. /// \nFieldName : All crushers with this same field name will share a crusher instance, even across components and scenes. /// \nComponent and FieldName : All instances of this component will share a common crusher for this field. /// </summary> /// <param name="shareBy"></param> public SharedRigidbodyCrusher(ShareByCommon shareBy = ShareByCommon.Prefab) : base(shareBy) { }
/// <summary> /// Constructor that uses StackTrace and SerializedProperty to determined which instances are common and should share a crusher instance. /// \nPrefab : All instances of a prefab will share a crusher instance. /// \nFieldName : All crushers with this same field name will share a crusher instance, even across components and scenes. /// \nComponent and FieldName : All instances of this component will share a common crusher for this field. /// </summary> public SharedElementCrusher(ShareByCommon shareBy = ShareByCommon.Prefab) : base(shareBy) { }