Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by JustANormalGuy · Aug 18, 2011 at 10:24 PM · classweaponcustomcreateattachment

How does one implement create-a-class?

As you can see from the comment below, I must not have explained myself in well enough terms for one particular user. Now please allow me to ask this answerable question in more simpler terms. Let's say we have two guns. A red gun and a blue gun. Both the red gun and the blue gun can have either a silencer or a grip.

I would like to create separate entities:

Guns: Red, Blue,

Goodies: Grip, Silencer,

Instead of separate prefabs:

Red Silenced, Red Grip, Blue Silenced, Blue Grip,

Because I will add a green gun and an orange gun later, I want it to look like this:

Guns: Red, Blue, Green, Orange,

Goodies: Grip, Silencer,

Instead of this:

Red Grip, Blue Grip, Green Grip, Orange Grip, Red Silencer, Blue Silencer, Green Silencer, Orange Silencer,

If you still do not understand my "create a class" example, you may remember playing a game like Call of Duty, Battlefield, Brink, Ghost Recon, Team Fortress, or Homefront.

If you honestly cannot help me, please refrain from being "that guy" and leaving an unnecessary comment followed by laughter. I am very willing to reply. I will be checking up on this several times a day.

Because I know that those on Unity Answers (and all programmers for that matter) do not usually like to give hand-outs, I will now share with you what I have been doing so far: Created a menu, where you may select the attributes of your player. On the menu is a button which allows the player to enter the multiplayer arena scene. In the multiplayer arena scene is a game object called "Spawner" which "uses" the data from the menu script to create a player prefab (player and gun are one prefab). This is the only way I know how to do it, but I know there is a better way.

PS. Bookmark or subscribe this page if you have the same problem. I will find out how to do it eventually and post it.

For those wondering how to get started, I am going to suggest searching how to make the gun pickup separate from the player.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · Aug 19, 2011 at 12:59 AM

"UnityAnswers is a place for questions that can be answered! Avoid asking questions here that are subjective, argumentative, or require extended discussion." - FAQ

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image logty · Aug 19, 2011 at 01:38 AM 0
Share

lol, he had that one co$$anonymous$$g

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How do we create a custom class in scripting? 1 Answer

making a new weapon script 0 Answers

How to create a 2d array of a class 1 Answer

How do you make a custom inspector for a class or instance? 3 Answers

Serialized class, Instances and access 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges