Swap between placing blocks to weapon?

so i have my player placeing blocks like minecraft but now i want to know two things if its possible for you to answer anything please do so ^-^

so i have the BlockPlacer in the camera and i want to be able to press “1” to swap or deactivate that script and make the other one enable (“gun”)

how would i go about doing this?

and the next questions is simple i think, how would i make the object appair in my players hand? i have an Bone/armature in his hand that i want the objects x,y,z to be locked to and when swaping weapons it destroys and spawns the other object in his hand

thanks in advance for any info :slight_smile: also an explanation on how it works would be cool (you dont have to) :slight_smile:

For the script switching you could use:


GetComponent(NameOfScript).enabled = false;

And for the visual switching, you can set up the visuals all overlapping each other and use:


GameObject.Find("block");

to find the game objects (the block/gun)
and use:


block.active = true;


to actually enable or disable them individually