I have a power-up GameObject with a light component attached to it.
The sprite shows up fine, however, the halo effect does not work when the GameObject is placed over another sprite (eg a background wall).
I think its a problem with the material (as I have tried other things such as changing the culling mask, ordering layer, etc) - however, I don't know which properties to change in order to make the light visible.
I am using an area light.
I hope I saw correctly your game is 2D. If so, check out 2D Lights
Related
I'm trying to animate a face using Anima2D for rigging.
Anima2D generates Sprite meshes for sprites that would be rigged and animated.
My problem is that I need to hide the tongue and teeth inside the mouth, and for that I was using sprite masks which are static and don't deform.
Is there a way to use sprite meshes as sprite masks? Or is there any other solution that I can use?
The image is an example of what's happening when I move the mouth (which uses sprite mesh). As the sprite mask (marked in orange) don't deform, the teeth and tongue bypass the mouth.
PS: I've found about stencils, but I don't think they would work since I need to hide sprites inside sprite mesh (not normal sprites).
In general, you would just need to change your "mask interaction" setting on the SpriteRenderer component on your tongue and teeth gameobjects and play around with the "Order in Layer" or "Sorting Layer" on these objects as well. Here's a quick example of what I quickly put together. Note the highlighted area:
I have in the scene in the Hierarchy Directional Light added automatic when creating new project. And then I added also a spotlight.
I didn't change or disabled the spotlight just added it to the hierarchy: GameObject > Light > Spotlight
But even if the scene is dark or not the spotlight is like turned off.
Then I went in the editor to the menu to: Window > Lighting > Settings
Not sure 100% what I did but I changed the
Skybox Material to FrameDebuggerRenderTargetDisplay.
Then I changed the Albedo Boost by one value and it made it all dark black.
In the end I got this dark/black scene and still the spotlight is turned off.
My main goal is to make everything black/dark and use the spotlight to light on specific place/area.
But not sure if making this scene dark is the right way and not sure why the spotlight is not showing light at all.
I have on the scene some spheres and a character I want to spotlight on them.
There are can be different issues.
Intensity is not high.
Your player quality settings are not set to fantastic, check it change it(see below image
Your light button may not active in scene (See below image). At the top of the scene view is a button that toggles scene lighting, activate it and you should get the correct lighting.
or your light culling mask set to nothing
I want to create a dark scene. The player just got a torch in his hands so this is the only light in the scene.
So the rest of the area should have no lights in it. Maybe it's a cave or a dark forest?
In Pokemon you had this effect in dungeons
Here is a rough sketch how I imagine it
So when I want to set the directional light of the scene to complete black color, you can still see good enough.
How can I archieve these effects of having a dark world?
I don't want to use a texture around the player or something like that. Maybe you can still see through darkness but really really badly.
Use this scene as an example of how to do that:
https://github.com/Galandil74/Unity-Spotlights-Example
Basically, as Lestat already said, you set the overall brightness by changing RenderSettings.ambientLight, then to create the torch effect, you use a directional light game object with a texture cookie in order to illuminate only a portion/shape of the screen.
Remember that to get full illumination through the cookie texture, the light must have its intensity propriety set to 1 - RenderSettings.ambientLight.grayScale (if it's a directional light).
I prefer to use directional light because you can then control the effect via the alpha channel of the cookie texture.
And if you're using sprites (for background, etc.), if you want them to be affected by the ambient light, remember to use the Sprites/Diffuse material.
I just simply want to know that does culling affect the animation cause i have some culled animation object which some time work and some time not as I move my camera in the scene?
I search on google I found AnimatorCullingMode.then I check my animated object in culling type basedOnredere is selected. Do I need to change it to alwaysAnimate.
After working a 4/5 days on this issue, Finally I got the answer(silly me).
Yes culling affect the animation using animation component's property which is called Culling Type as Figure show.
Previously My all animation Culling type were selected to BasedOnRenderers that's why my some animation working while some were playing continuously. As I got that:
BasedOnRenderers: Animation is disabled when renderers are not visible.
This culling method is more suitable when you have renderers attached after import - it will take renderers (like mesh renderers, particle renderers and so on) attached to this gameObject or children of this game object.
while the option I now selected which have solve the Problem (Al-Hamdullilah)
said:
Always Animate: Animation culling is disabled - object is animated even when offscreen.
I'm making a zelda-like 2D Role-Playing-Game with XNA and wanted to implement a camera which follows the player today. Soo... I didn't really understand how it's working, but I found a nice code-example here: http://www.david-amador.com/2009/10/xna-camera-2d-with-zoom-and-rotation/
I implemented it and changed the spritebatch.Begin(); to what the guy in the thread said. Now it is working ... well. The collisions are alright and the player is centered (since I set the position of the camera to the position of the player once a frame) but: The textures don't get drawed the way they did before. So for example the shadow is drawn under the grass (=you can't see the shadows) the player is sometimes drawn over the NPCs and sometimes under them and the wall-tiles disappear and reappear like they want :(
Do I have to change the drawing-code or the order they get drawn?
Hope somebody know what I am doing wrong...
In your Spritebatch.Draw call you can specify the layer depth. When specifying the layer depth, you will need to use the proper Sprite Sort Mode when initializing your SpriteBatch.