Remove With Tools Prefab Constructor

This script should be attached to prefabs that are already placed and need to be removed.

If the prefabs were required to be removed with the user’s hands, the developer should use the Interactable Prefab Constructor (mentioned in 5.2.).

In this case the prefabs need to be removed with the use of another gameobject, in this script’s case, the user-defined tools (where these tools are held from the user).

Variable Name

Type

Description

Attach Prefab Spawn Notifier

boolean

If true, it will attach to the object a script that flashes it to be recognized visually from the user.

Drop Distance

float

Set the minimum distance for the prefab. If the user removes with the tool the prefab but drops it to close to its starting position (distance smaller than the float given), the prefab will return back to and it will need to be removed again.

Remove Tools

List of ToolsEnum

Select the Tools with which the user can remove the prefab.

Prefab Creation Requirements

  1. Rigidbody

  2. Trigger Collider

  3. Non-trigger Colliders

Warning

The non-trigger colliders are optional. It’s there to help with the user presence. When the prefab is removed it needs to have all the physics properties and collide wherever the user is going to throw it.

But, the non-triggered collider will be disabled on spawn, otherwise they will bug (in physics level mostly) with the tool that will also have same type of colliders. These non-triggered colliders will be enabled only when the user will have removed and dropped the prefab away.

If the prefab still does not behave properly, leave it with ONLY the trigger colliders.