L
L
Lesh482020-07-16 17:17:18
Unity
Lesh48, 2020-07-16 17:17:18

Unity The object is in a different layer, but the code says otherwise. How to fix?

There are several objects on the scene, they have 2 types of layers (layer1, layer2), layer1 has the most objects. All these objects are combined into one object ("mainObject"), which has a Default layer.

But in the mainObject.layer code, not the Default layer, but layer1 will be displayed! Why and how to fix it?
(Unity2d)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lesh48, 2020-07-21
@Lesh48

The error itself was due to the fact that unity offsets the layers by 1, and the answer is here:
https://gamedev.stackexchange.com/questions/119667...

X
xmoonlight, 2020-07-16
@xmoonlight

The problem is in your code.
Look for your object there and after that - request properties.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question