- Home /
Can't add custom tag/layer. It just turn back to 'Default'
Hello, I've recently started using Unity so please forgive my lack of knowledge.
i have try to put the 'tag' and the 'layer' for my game object, for example, i do a custom tag named 'Land' and i choose 'Land' as my tag/layer, but then when i save it, it just turn back to the Default, or when i want to 'Apply' it to all, means all prefab, its just also turn back to the Default.
for all of my game object, pictures we use ngui, sprite, panel editor and such. i don't know if using it, it will came out all of the problem.
it doesn't have any error but there is the warning, this is the warning,
"You can't place widgets on a layer different than UIPanel that manages them." "If you want to move widgets to a different layer, parent them to a new panel instead"
What have i try is that, i try to create new panel, then put the gameobject as a child to it and try to add the custom tag/layer to the parent, but still not working.
i don't know exactly what it is saying, i still new to this unity.
i hope somebody can help, Thanks :)
This basically what i'm doing. Like a platformer game.
Answer by dorpeleg · Jul 31, 2013 at 06:17 AM
First, don't confuse between tag and layer, they are diffrent things.
Second, your error seems to be related to NGUI.
What I think you are doing, is placing all of your gameobjects under the NGUI gameobject, which is not the correct way of doing it.
The NGUI gameobject (I don't remember it's name) it only meant to have the GUI related gameobjects as it's children, everything else (such as coins for example), is not meant to sit under the NGUI gameobject.
First, thanks for answering my question.
By the way, all of the objects such as the coins, trees, land i put it using NGUI. and all of it are the children to the camera which is children to the UI Root(2D).
Then when suppose i do ya? Is it anything can i do? any solution?
If you used NGUI for everything (not the right way), then you can either redo a lot of the things outside of NGUI or if you can explain what you need the tags/layers for, maybe I can help you think of a different solution.
Ohh really?? Can i know why it is not right to do everything using NGUI ya? so that i can learn what is my mistake there.
Before this i have try using Uni2D, to put the picture in the game, but currently i'm using the new version of unity, which is 4.
what i know Uni2D is specially built for unity 3 and still in beta version. Correct me if i'm wrong.
So if i'm using Uni2D in unity version 4, is a bit difficult to work with. Do you know better solution to this kind of problem?
Next, for the tag/layer, at first i used the tag 'Player' for the Runner there, and i don't want the Runner to collider with something in my game, such as the obstacle just for a seconds maybe, then after that, if the Runner collide with the obstacle then the life given to the runner will decrease.
For you info, in this game, there is many obstacle, with different type of the collider, so i think i need the tag 'Obstacle'. So that i can tell the game not to collide with the collider name 'Obstacle'.
Sorry it's a bit too long. I hope you can understand what i'm trying to say (:
I understand :).
I don't know what Uni2D is, so I can't help you there.
It is not right to do everything with NGUI for a simple reason.
NGUI (as the name suggests) is only meant for GUI (graphical user interface).
NGUI is not meant to be used for characters, collectibles, obstacles, etc (even tho it can, in theory).
please explain: are you using tag or layer?
void enableBox(bool condition)
{
GameObject [] Obstacles = GameObject.FindGameObjectsWithTag("Obstacle");
foreach(GameObject obstacle in Obstacles)
{
if(obstacle.GetComponent<BoxCollider>())
{
obstacle.GetComponent<BoxCollider>().enabled = condition;
}
}
}
this is the coding i'm trying to do.
Your answer
Follow this Question
Related Questions
GetComponent, gameObject.tag vs gameObject.layer 1 Answer
Is there an easy way to apply the same tag to all children of an object? 4 Answers
Unity Raycasting a tag rather than layer 1 Answer
change layer of child 5 Answers
Is this workaround OK? It's for fixing lost tag/layer info on export/import 1 Answer