- Home /
Answer by Bunny83 · Feb 01, 2012 at 05:30 AM
No, because the layers are represented by an integer bit-mask. An integer is made up by 4 bytes a 8 bit == 32 bit. You can't add or remove bits it's more like a hardware (or hardcoded) limit ;)
I can't imagine any usecase where i would need more than 32 (or even 24 since 8 are predefined) layers. Maybe you can describe your problem and we find an alternative.
Our game have 6 players.Each of them have 2-6 layers which control their different mesh to receive different light.Another way to say is our artist
need each player's each place(like:head,body,dress,hair and so on)have different lights.How to do it? Thanks for your help!
Or maybe our problem is we need player's light and they only affect their player
.If we need 100 players,we need 100 layer?
Why do you want to use different lights on different body psrts? That won't look very realistic in the end and like you already discovered it's a pure mess. Lights are not ment to change the look of an object. Lights actually should be used like real lights. If you want to change the appearance of an object you usually change / modify the material. Such things should be done in shaders.
Then you are using it wrong. Simple as that. Use the documentation and understand the documentation. `Physics.IgnoreCollision`
Your second wrong assumption. When you have n $$anonymous$$ms and m objects, you'd already (hopefully) have a list that manages or keeps references to all of them. Then you'd need to go through them and register it once when the player is instantiated.
Or easier, doing it the other way around: Have an observable list for each $$anonymous$$m and register your objects for this lists and on initialization, player join/leave/$$anonymous$$m change or when their state changes perform your changes.
It's unlikely to happen that your objects will change 20 times per second and iterating or looping through the $$anonymous$$ms which shouldn't have more than a handful of players on a state change isn't really something to worry about.
Having 24 layers is no excuse for not using your brain to solve a problem. Physic layers are for generic uses. Your use case above is pretty special and special problems require a special solution. Simple as that
Answer by Tseng · Feb 13, 2012 at 01:56 AM
In regards to your comments in Bunny83's post:
You need a custom color shader to make this work, if that's what you're looking for.
With such a shader, you can have a normal diffuse texture + a color mask texture. The color mask texture would have 4 channels (R, G, B and A) for up to 4 different color areas.
Let's say you want the first part of your armor to be color 1, then you'd have to paint all the areas in red (the R channel in RGB). And a second area with blue (B channel) etc.
Then in the inspector you can set up a color and this color will be applied on the marked areas.
There is a tutorial for Strumpy Shader Editor 4.0 on how to make a color shader. http://www.derekmbest.com/shaders.html
It's not very good in terms of performance and it it has some flaws (i.e with the 4th color), but it should be good enough to give you an idea. I've recently made my own shader, took me whole three days to get it done (because I have/had zero experience about shaders), but works flawlessly now
Your answer
Follow this Question
Related Questions
Array out of its own range? 4 Answers
See whether player is in range of light 2 Answers
Does rapid layer changing affect performance? 1 Answer
different reaction to collisions 1 Answer
Sort Multiple Arrays By Their Length 1 Answer