Is there any way to replace a model with other model?
I need this for switching weapons in a platformer game. Is there other way to do it?
Is there any way to replace a model with other model?
I need this for switching weapons in a platformer game. Is there other way to do it?
Instantiate
Destroy
Hm I tough this would be a good idea as well. Thank you!
Actually, how did the code in the FPS tutorial work when it came to replacing weapons? It revolves around the same idea (switching weapons) it just doesn’t need to be a machine gun and a rocket launcher (as seen in the tutorial)
I do it like Teriki Tora just mentioned, similarly to how the FPS tutorial handles it.
Make a new empty gameobject that is a child of your player, called something like “WeaponManager”, then make all your weapons children of that object. Then write a script for WeaponManager than handles the logic for enabling/disabling the weapons with gameObject.active = true/false.
Something like this:
if(Input.GetKeyUp(KeyCode.Alpha1){
//disable all children
//activate the desired weapon
}
Yeah that looks like a nice idea too thanks!