Armin
Armin

Reputation: 599

Unity Blank Layer Mask

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.

Upvotes: 0

Views: 3434

Answers (1)

Programmer
Programmer

Reputation: 125245

This is just a layer with no name and you can easily re-create that.

To understand what's happening, go to Add layers:

enter image description here

See the image below:

enter image description here

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:

enter image description here

Now, you can use one of the AssetPostprocessor functions to detect when anything is imported then automatically change the layer to an empty layer.

Upvotes: 2

Related Questions