I am a VR developer but never had to code thanks to the tools readily available but now i have decided to make my own game and learn C# i have looked here and there but cannot find a definitive answer. To be more specific player is in hub and makes adjustments to a weapon that is in my game. Player doesnt start with this weapon, should player interact with an object that can spawn this weapon how do you make it spawn in to them with all the attachments and skins they added back in the hub
CodePudding user response:
You can add the Game Object with the weapon in DontDestroyOnLoad after the player is done and move it back to scene and use it. (I suppose you change the scene from hub to game, after customizing the weapon)
Use it on a script, that have the weapon as reference:
DontDestroyOnLoad(weapon);
Then, use this in the other scene, to get it back and put it in your character's hand (you need a reference):
SceneManager.MoveGameObjectToScene(weapon, SceneManager.GetActiveScene());
weapon.transform.parent = characterHand.transform;