Unity modular NPC - unity3d

We are developing a Top Down RPG Game. So, there's a question about NPCs. Making a lot of NPC FBX files would not be optimal. From what I know, people usually make 3-4 bodies and a bunch of heads, so the NPCs would look different. Do you guys have any idea, if there's an optimal way of doing that?
I tried modelling bodies and heads in separate files and then putting heads onto the empty object on top of the body (this empty object was part of the FBX itself). It didn't work, as the actual head always displayed too high above, so it looked like the head was hovering in the air.
I also thought about making heads a part of one big FBX with just one body. So all the head would be on the same coordinate in space, and so in Unity there would be a possibility of making active just one head in time. I still don't think it would be very optimal.
So, is there a way people usually do this? I mean, this must be really common. They used it in Gothic, for sure and in many other games. So there must be an optimal way, but I'm unable to find it.

There are a few character customization packages available on asset store that you could use. I recommend UMA2 (Unity Multipurpose Avatar). It is a perfect tool and I'm using it on one of my projects and it's really gets the job done. And the good thing is that it's free. Once you imported it into your project, you can either buy contents (cloth, hair, face, ...) or create your own contents like I do using blender. There are tutorials about how to integrate and create contents on Secret Anorak youtube channel.

Related

Make character face from photo for unity

I'm new to Unity 3d. I'm trying to create human character with face generated from photo. (to give real face look) I tried UMA 2 plugin, but it does not support changing face. I searched and found 'Avatar Maker UMA' can do it. Avatar maker UMA has low quality.
Is there any other way or software to create character from photo and use it in Unity 3d? Would appreciate any sources.
For the Unity Engine is quite impossible to generate faces, you should to it in another system but I want to share with you some ideas from the internet:
Can Unity generate faces?
"Yes and No.... Unity has zero support on this feature out of the box, in fact unity has virtually nothing in this regard, it engine that you design. that's what makes it so versatile and malleable. your problem has virtually nothing to with unity its self. in other words unity won't do it for you but it can be done within it.
but is probably possible if your willing to work really hard at it, many things are possible within unity that it does not come with. however generating 3d detailed meshes from a picture is a really daunting task, your basically need to do some edge detect algorithms... Oh god, its... its nightmare. its even harder because you going straight from scratch.... look I strongly suggest you get real good practice in programming and a really good understanding of how the 3ds does that exactly or you will be in the dark on this one.
Unity has a MeshClass that you will need and the webcam texture.
http://docs.unity3d.com/ScriptReference/Mesh.html http://docs.unity3d.com/ScriptReference/WebCamTexture.html
you can use that for the actual generation. but as i said, it is an absolute nightmare of a job.
I hope this answer's your question"
But there is a new plugin that maybe can help you, it's called AVATARSDK and can generate 3d faces.

How to avoid Unity Complie all Standard shader variants

When add Standard Shader to Graphics——Always Include Shaders, Unity always stucks in sharedassets0.asset. I know it's unity complies shader variants in the background. it's about 60000 variants which make the .apk size is triple bigger than normal size. And it takes a long time(a couple of hours) to build, even if an empty project.If I remove the shader from the list, when I load a model from asset bundle, it will be a pink.Only add Standard to the list, then everything is ok!Is there any way to solve this problem? Please help me!I googled all I can google!
Edit: Unity 2018.2 added IPreprocessShaders which is described at:
https://blogs.unity3d.com/2018/05/14/stripping-scriptable-shader-variants/ You can review each individual shader keyword combination in IList<ShaderCompilerData> and remove ones you are certain you don't need. The this API is not complicated, but standard shader keywords are not well documented. Some of the keyword correspond to enum BuiltinShaderDefine while others are not. I ended up using this preprocessor to remove any ShaderCompilerData with BuiltinShaderDefine.UNITY_HARDWARE_TIER1, BuiltinShaderDefine.UNITY_HARDWARE_TIER2 and INSTANCING_ON(This is not in the BuiltinShaderDefine enum) turned on since I am certain we didn't use quality settings toggle and instancing.
The Unity Shader Variant Collections works kind of wonky. I ended up using a plugin called "Shader Control" to clean up the mess. But the process is still far from enjoyable since when you remove a keyword there is a chance you break something.
The best solution I could think of is remove all the "Built-in Shader" (Maybe not "Deferred" is you are using Deferred Rendering) and "Always Include Shaders" at the beginning of the project and if someone needs a built-in shader, download "Builit in Shaders" from the Unity Download Archive and import only the one needed back to the project. So that you can:
Have 100% control over built-in shader
Only compile shaders you used
Avoid shader duplication in AssetBundles (If you pack something referencing default imported shaders, the shader will be duplicated for each AssetBundle)
But this "best solution" is certainly more of a hindsight and does not help your current situation though. Give Shader Control a try.
Hi I want to suggest a method that worked for me. I was going to comment but my reputation hasn't reached 50. I would not recommend this as answer but no harm for you in trying I guess.
Instead of including the shaders under Graphics——Always Include Shaders I went to Project Settings -> Player -> Optimization and included the shaders under Preloaded Assets.
I also have doubts if it is the correct way to do so but it solved my problem. I would be glad if anyone could point out what was wrong about it and explain a bit, as I could not find much reference to this method on the Internet.
I have posted a similar question at game dev stack exchange
https://gamedev.stackexchange.com/questions/190092/unity-2020-3-what-is-best-practice-to-include-shaders

Mapping Actions to a Node-based editor using Unity3D

My question revolves around how to get behaviours described by a node-based editor to map to actions in-game. I've searched for several weeks about how to do this but can't find anything. If anyone could point me in the right direction, I'd be really grateful!
I don't know the best way to ask this question - I don't want to overload the question with what I've done, so I'll elaborate a bit below, as best I can:
I currently have a custom node-based editor I wrote for Unity, which I use to graphically edit the behaviour of bosses and NPCs. It looks like this (with the right-click menu shown):
I did find a way to get this behaviour working in-game, but it feels wonky and I'm wondering if there's a better way.
The way it works is there are two objects to be serialized per node object. I currently have these setup as scriptable objects, though if I were to do this again I'd create my own kind of serialization. These two objects are:
The Node in the editor window, containing editor scripts
The associated in-game action, to be loaded by the NPC at runtime
This creates a bit of mess in the file structure, as well as the amount of script files I need. On top of this, it's a bit tricky to manage cases where multiple actions are being performed simultaneously, and I need to change the NPC's state (e.g. phase1 to phase2 of a boss fight), which sounds to me like a design issue.
I'd be happy to share source code or more screenshots, if at all necessary. What I'm looking for is a way to approach something like this in a structured way that allows scalability for other projects (e.g. NPC behaviour for an RTS)

Exporting lightmaps to another project - Unity

We are currently working on various project as a team. As such, we often have to transfer scenes and such from one project to another. However, we have a problem concerning the lightmaps.
When I take my scene, make a package out of it all (lightmaps included) and then export, when I import in the other project, the lightmaps are there, (as in, in the "Lightning" window, they are present and loaded) but they just don't apply on the scene. It's like they aren't here at all.
And so we have to rebake everything, which makes us lose hours of work. (And as the graphic guy, it frustrates me that I have to wait two times)
Any tips on how to deal with this issue ?
Thanks !

Tracking a 2 dimensional sprite in Java

I'm kind of new to this whole thing but I'll get started by asking my first question ever.
So a friend and I are working on a project in which we need to track the player character's head movement and attach items to it. Now is this something that needs to be done in Java or would this be something that would be done in Unity?
Sorry if this is a stupid question but I've never really worked on a project of my own volition before.
Thanks,
BadAssWalrus
Ok, so first things first. There is no java in unity, you can do scripting in C#, UnityScript (essentially JavaScript) or Boo.
Now to answer your question, according to my understanding you want to move some objects as the head of the character moves. Now depending upon how you are really trying to move the objects you could either do it with scripting or simply by making the object you are trying to move a child of the head of the character.
Unity has excellent documentation about the scripting API and a lot of tutorials. I suggest you get started by looking at one of these tutorials, and you should get an idea of how things work pretty soon and then you should be able to do pretty much anything you want to do with relative ease.