您如何获得一个特定武器的物体,但带有附件和皮肤

发布于 2025-01-31 02:16:13 字数 114 浏览 4 评论 0原文

我是VR开发人员,但由于易于使用的工具,我从来不必编码,但是现在我决定制作自己的游戏并学习C#,我在这里和那里都看过这里,但找不到确定的答案。更具体的玩家是在中心,并对我游戏中的武器进行调整。玩家不会从这种武器开始

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

幽蝶幻影 2025-02-07 02:16:13

在播放器完成后,您可以在dontdestroyonload中使用武器添加游戏对象并将其移回场景并使用它。 (我想您在自定义武器后将场景从集线器更改为游戏)

在脚本上使用武器作为参考:

DontDestroyOnLoad(weapon);

然后,在另一个场景中使用它,将其放回原处并将其放在角色的手中(您需要参考):

SceneManager.MoveGameObjectToScene(weapon, SceneManager.GetActiveScene());
weapon.transform.parent = characterHand.transform;

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;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文