Unity Blank Layer Mask - unity3d

So I'm new to unity and I was wondering how can I remove the layer mask on a game object? Every time I create a game object, it has 'Default' layer mask like this picture :
http://www.upsara.com/images/8ha1_untitled1.png
I imported an AI package and I noticed that all npc characters in this package don't have a layer mask like this picture :
http://www.upsara.com/images/uv73_untitled2.png
And I dont know how is that possible and I want add a few new characters but when I import this new characters and add them to scene thier layer is 'Default' and AI system wont intract whith them.

This is just a layer with no name and you can easily re-create that.
To understand what's happening, go to Add layers:
See the image below:
Notice how layer 3 doesn't have a name? That's what that asset is doing. It is setting is layer to a layer that not named. For example, layer 3, 6, 7 and 10 are not named in the image above.
You can do that from code. Let's set it to one of the empty layers (6):
this.gameObject.layer = 6;
This is what happens:
Now, you can use one of the AssetPostprocessor functions to detect when anything is imported then automatically change the layer to an empty layer.

Related

How to add a a get a simple flag with 3 stripes on a Cube in Unity

is there any way to give a simple 3D cube in Unity the look of a flag without displaying the whole flag on every side. So that as example the top stripe also fill's the whole top?
The default mesh unity provides for cubes always show the same texture an all6 sides, so they are always all the same. Whatever material/texture you apply.
The one material is used an all sides, with UV values from 0 to 1 (whole texture).
Even fiddling the UV scales on the material does not help as the 6 sides all start with the same range.
I you wish to change this, you need to edit/create you own mesh for a cube which allows different UV settings for the 6 surfaces, or multiple materials. You could make one which has a second material for one of the 6 faces and assign your flag texture there.
(Unity does not really provide mesh editing. I used blender for this.)
In Unity, you could create an empty gameobject, add 6 'quad' objects, and use different textures on these. Then this set of 7 objects behaves like a cube, but with different textures (and less performance when using lots)
Why not just use a single quad for the flag?

How can i draw an object before its parent object?

How can i change the sorting layer of objects in Unity 2D? Like force an object be rendered above (or under) another object even if it is a child of the other object.
I'm making a simple 2D humanoid animation, intuitively i'm using the torso as the root object, and the arms and legs be the child of it. But it results that my left arms is rendered after the torso, so it looks like my character have 2 right arms.
I tried to change the Z value of my arm, change the layer from UI to others, and tried to change some settings in my Canvas. But none of it worked.
I'm using RawImage to render my character, could that be the problem?
Have you tried using the sorting layers? Unity allows defining sorting layers for 2d sprites. You can select a sorting layer in the sprite renderer component,
You can create and order them under: Under "Tags and layers"
You can also order sprites on the same layer by changing the "order in layer" value in the sprite renderer component.

How to create a human model that has separate parts(hand, leg) in 3dsmax,Each part should be able to get selected as object in unity?

I m a beginner in both unity and 3ds max. When i create a human model that is used to load into unity when i create it , it would go as separated(which i want but during animation each part is getting separated and act independently) but when i add skin(connection between parts) every part is acting as single object and when i change color every part is having same color which i do not want. simply i would like a human model where each part can be selected separately but are connected in unity.

Best way to create an interactive map using an existing image

I'm trying to create an interactive world map like in Europa Universalis IV or Crusader Kings II using Unity3D. These two games create the map using an existing image (like this https://i.imgur.com/y2gtX2N.png). I have never done something like this before and I'm really confused on which is the best approach/technique to use.
What I need is an idea on how to show the map and be able to select every single province taken from the image.
My method would require you to provide each region as an individual sprite.
1) Add all sprites to the scene and form the world map (SpriteRenderer or UI.Image).
2) Make a Component that handles interaction, and add it to each World Map Part GameObject.
Implement the following interfaces to it, and specify the logic accordingly:
3) Add the Polygon Collider 2D Component to each World Map Part GameObject.
4) Add the Physics Raycaster 2D Component to your Camera.
If you choose to use UI.Image (which I do not recommend), you can skip steps 3 and 4, and instead set alphaHitTestMinimumThreshold to 1 on your World Map Part Component's Awake().

Duplicate a gameobject in right way Unity 5

I have a game object named Bolt with for example white texture , when I duplicate that and rename duplicate into EnemyBolt and change texture to orange the Bolt texture is changing into orange too , how can I copy or duplicate a gameObject that dosen't change its reference?
When you duplicate a GameObject, you also duplicate all the components that are attached to it. This way the new object gets its own set of component instances. This is in Hierarchy panel representing the content of the scene.
The Project panel represents the assets to be used in the different scenes. When you drag a material to a Renderer, that renderer instance points to a material that will be instantiated at runtime.
In order to optimise rendering process, if a material is shared among many object, only one material is created, this will reduce draw calls.
Now for your solution, you need to duplicate your material and assign the new one to the new object. Now, when you change it on one side, it does not affect the other since they are using different material. On the other hand, you increased the draw call.