How to fix console error in Unity 5 - c#

I'm newbie in Unity & I wanted to add a water to my scene but the water that I added looks purple and I got two error messages as well in my console which says:
Material Does Not Have A Color Property
So how to fix this issue ? There must be a problem with my shader texture however the material has the write texture.. Print Screens Are Below:

That's the graphics card's way of telling you it doesn't know which shader to apply your object.
Click on a mesh that is pink, and the material property will be set to none or missing. You'll need to remap the materials in your project to your pink objects, or drag the textures back onto your objects again.

You are seeing this pink color because a shader is missing or is not properly selected.
I'm sure the following is the error you'd encounter in the inspector:
This is how it should look if everything is correct:
I selected the shader in the file browser so you can check the location yourself.
Resolving the issue
The first thing you could try to resolve this issue is open the shader tab in the inspector and search the "Shader" dropdown menu for the water shader:
If you can't find it there the only option is to reimport the assetpack.
Or copy this shader from another project where you still have it.

Related

Is there any way to render an object while standing in it?

I have a first person controller and currently if I walk into a slightly transparent object, it disappears until I walk out of it.
I have a 'water' cube object that is very light blue and transparent, and when I move my camera into third person view then enter the water, my screen turns light blue which is good. In first person mode (which is what I'm trying to figure out), the cube disappears and my screen color remains the same.
I know it has something to do with my camera but even after going through all the features on unity docs and changing a few settings in the inspector, it all remains the same.
Like mentioned in the comments your cube is not visible because the backside of its faces is being culled, meaning they are not rendered. This is not a camera setting but a property of the shader your water cubes material is using.
You could create get a duplicate of the shader your are using where you add Cull Off to change this.
Read about it here.
If you want to go that route you need the source files for your shader. Assuming it is one of the Unity Built in shaders you can get them from the Unity Download archive here for your Unity version.
Clipping the camera trough objects is rarely a desired and you should look at a different way of achieving your effect like using a post-processing volume because the "water" would still be a cube and be drawn behind everything in front of its faces.
For example in a FPS type game this would result in the gun not changing color.

Im trying to create a menu scene but when i render it, it is kinda dark. How to fix the dark lightning

As you can see in my Unity scene
it looks dark.
game tab
you can see here that it's dark.
I've done going to window > render > lightning > clear baked data but its still the same.
Any unity devs can help me, thanks
As you can see in my lightning tab
auto generate is disabled so I can't check it to verify if it can solve my problem.
Somewhere in the Canvas you have an object that has a sprite on it where the color is modified. Also check the alpha setting for the colors there.
Lighting doesn't affect UI elements like that. That only applies to non UIElements like 3D and 2D objects placed in the world (https://docs.unity3d.com/Manual/LightingInUnity.html).
So it's just a sprite that is causing this background color as #Çağatay IŞIK suggested.

Screen Space Ambient Occlusion (SSAO) being rendered for clipped meshes

I am working on a small game where I only want to draw the objects (mesh) when it is inside an invicible box. I have gotten the clipping to work so that the mesh is only rendered inside the box (using the solution mentioned here: https://answers.unity.com/questions/1875660/urp-render-only-whats-inside-a-cube.html
The only annoyance now is that even when the mesh is clipped, the SSAO is still being rendered as you can see in the following image (in the red box):
I assume it is because the object is still contributing to the depth normals - but I am unable to find more information about this - or even if this is the actual issue.
Do any of you have a suggestion for how to prevent this from happening?
I am using Unity 2021.2.8f and URP v12.1.3 btw
The Postprocessing effect SSAO is applied to all layers seen (not culled) by your main camera. Try to put the object on a different layer and ignore it on your main camera.
You could also integrate an additional forward renderer (+ new camera) to your project, which does not use the SSAO effect and takes care of your object.

LineRenderer Alignment Not Facing Vuforia ARCamera

I am trying to create a Line Renderer that renders a line between several objects augmented with Vuforia image targets.
I understand that the Line Renderer component has the "Alignment" field which can be set to either "View" or "Transform Z". For my project, I need the rendered lines to always face the camera, so I have that field set to View. Here is a picture of the component:
However, in both the Unity Editor preview and on my deployed Android application, the line rotates along with the objects (for example, if I move or rotate the image target). The ARCamera is already tagged as MainCamera, so it should be recognized as the camera.
Once I noticed this, to test if the field was being overwritten somehow, I added the line lr.alignment = LineAlignment.View; to both a start function at the beginning of the application, and to an update function, to make sure it is always set to View, but that did not change anything.
Is it possible for the Line Renderer to always face an ARCamera? Is there a step I am missing?
Here is a picture of the issue, where you can see that two of the lines are rotated to their side (the top line between the blue and green spheres is hardly visible).

Sprites drawing over text in unity

I am trying to display the score for my game, however, my background sprite is drawing right over it. I have tried assigning some type of layer tag but I can't find one for text. Everything I try, the text is always hidden under the sprite for my background (and any other sprite for that matter). Is there a way to assign the text to be drawn over everything, I have tried looking at tons of sites in hopes of a fix but I can't seem to find anything. Any help is extremely appreciated.
From the hierarchy creation menu, pick UI->Text
This will add you 3 Elements to the hierarchy: Canvas, and 2 child gameobjects which are Text and EventManager. These are all needed for the proccess.
The text gameobject is part of the UI system Unity has, means that if done correctly, it should show over all sprites.
Programmatically you can change text by simply saying:
myUItext.text = "Text that will show on UI!"
Manually you can change position, font and text using the hierarchy view.
For further details use this video from the official Unity tutorial

Categories