Prefab the Whole Platform- Game Dev Series 91

Objective: bundle the whole platform with ledge checker system into a prefab.

If we want to keep using the ledge grabbing system in game, create a prefab would be necessary. However, to copy the system without any bug require some adjustment.

In this article, we will create a perfect functional ledge grabbing system prefab.

Replace the Vector3 data

The most important thing to prevent bug is fix the static Vector3 data. So far we use a specific Vector3 value as snapping position and standing position.
To fix this issue, we can create 2 empty gameobject to storage the position.

Next we need to check the Vector3 value to these gameobject. Keep the value of Hand Position and Stand Position.

Play the game and duplicate Player. Make the duplicated Player into Hanging animation state, Then use the value of Hand Position to make it snap to the place.
Drag duplicated Player into Ledge_Checker as child object, and copy the local position value of that Player object.

Disable the Play mode, and paste the value to Hand Position gameobject. Now it should have the position where Player should snapped into.

And do the same setting to Stand Position.

Now we got the local position of Hand Position and Stand Position, we can adjust the Ledge script.

Use the new Vector3

Inside script, all we have to do is to create 2 variables of the gameobjects. And drag it in editor.

Then replace the origin Vector3 reference to these 2.

That should be done! Now we can prefab the whole platform and create some level with it.

A passionate gamer whose goal is to work in video game development.