- Home /
How to create a custom GameObject that can be created in the Hierarchy panel of the editor?
I am new to unity and I want to be able to create a class coin that has variables such as a 3d mesh and different color maybe for each object of its class. Lets for example say
public class Coin : .....
{
//variable for mesh component
//variable for material component
//additional variables
....
}
How can I make this an GameObject that I can create directly under the hierarchy tab by right clicking on the tab ? Is this even possible ?
I would like to create many such GameObjects for players / monsters / etc. Is this the right approach to how unity game developers usually use to create their GameObjects ? Or do I have to create a cube(any mesh) and then add components and scripts to it like how many tutorial video shows it ?
Thanks
Answer by JVene · Jul 21, 2018 at 07:25 PM
What you're thinking of are plugins for the Unity editor, and while possible there's a reason you aren't finding it already done widely. If you're a professional programmer/developer, you probably already know what to do with that capability. Otherwise, it is a very deep dive.
The particular models used in any game are the product of artists specialized in that work. For an indie developer, where one person does everything, it is really no different.
That said, if you look at a tool like Daz3D, where you can create characters out of parameters, it would be of interest to combine features of Daz, or some parametric character creator, within Unity. The point here is that there will not be a single monster worth making an object of Unity's editor, but a parametric character generator might be.
The problem is that 3D modeling tools are very complex editors themselves, and usually one application that does everything doesn't specialize enough to do anything really well.
Most games are made by building models in a tool like Maya or 3D Studio Max, detailing the textures within Unity (because Unity has unique requirements for textures/materials), then applying physics to the character.
After a while, one develops a number 3D assets which can be used in multiple projects. Once you drop the files into the appropriate asset directory, the result is an entry in the project window you can drag to the scene, and you almost get what you're asking for that way.
Thanks for your reply, I really appreciate it. I've come from a background of progra$$anonymous$$g where I encapsulate data into something like Actors in UnrealEngine and store references of pointers for other Actors (GameObjects) and therefore Unity style of progra$$anonymous$$g looks a bit different to get my head to wrap my head around it.
Your answer
Follow this Question
Related Questions
Is there an asset for that ? Need advice on game mechanics / game logic 0 Answers
Rider wired warning 0 Answers
Style labels in editor window (in scene view) 0 Answers
Hint at Inspector variables that have tooltips 0 Answers
Multiple editor windows combined 0 Answers