For weeks Ive had this problem trying to build my Oculus game to an executable build. Everything works in the editor but when I build, 80% my materials that have images/psd files as the diffuse and/or emission come out like this:
The build log gives me this, which I dont know what to make of:
I looked in graphics settings here and tried adding the standard shader in always included, and even tried pasting everything into a new scene:
But nothing works. And some images are working (see the blue screen with the thumbs up). But the rest do this. What could be the problem?
Related
This is my first time to make a Unity project. Everything works well on the Game view in Unity Editor. However, after I built the project and played it on Google Chrome, I found that the position of some gameobjects had been changed.
Here is a more detailed explanation. The left is what I saw on the game view, which was perfect. The right side is what I saw after built the project. The position of the grey picture had been changed.
Does anyone know how to fix this?
ps.I am using Unity 2020.3.18 with WebGL platform
Try exporting again but with the same resolution as the game view. In this case you would want to export in a 400x600 resolution (You can also edit the "index.html" file to change and experiment with the resolution). The problem has to do with the fact that changing the resolution of the game can affect where certain objects are and how much you can see.
I started up a new URP project with everything pretty much default.
When I first loaded in a scene I noticed some weird shading issues. There were two concentric circles that were shaded in a way that it seemed like a depth of field effect. I wasn't sure how to get rid of them, so I moved on.
I got a basic first person controller and discovered more strange artefacts as I started walking around weird line imperfections within the grids and such, and the weird depth of field of effect I found in the scene view carried over into the game.
I've tried to searching around to find out if anyone else has had this problem before me, but I couldn't find anything. I've also tried to change post processing settings as well as some basic lighting settings. Nothing seems to fix the issue.
This video shows the issue a little more closely: URP Artifacts
Ok, I fixed it by just creating a new project that did not derive from the URP template. Then I just manually converted it to URP.
I don't know why this happened when I was using the template. I don't know why this works. Probably it has something to do with the initial settings that come with the template, but that is just conjecture.
I have followed this particular tutorial: https://www.youtube.com/watch?v=ir9Rvi1QG8Y to add a particle system effect on a UI panel. It works well in scene mode and game mode but when built for android no particles are shown. I have tried tweaking the particle shader, material etc.. but to no avail. What do you recommend please? Thanks.
Unity version: 2018.2.11f1
Screenshot1
Screenshot2
After recreating the project myself I've found out that its because of a sloppy code in UIParticleRenderer class.
Shader foundShader = Shader.Find("UI/Particles/Additive");
in line 79
when you try the game in Editor "Find" method works correctly, but when you want to publish it to a device (android) it won't include "UI/Particle/Additive" shader so the shader won't be found.
there are 3 solutions to this problem as described for Shader.Find class in Unity documentation :
reference it from some of the materials used in your scene
add it under "Always Included Shaders" list in ProjectSettings/Graphics
put shader or something that references it (e.g. a Material) into a "Resources" folder.
I used the 2nd solution (which is easier to do) and it solved the problem. so you can go to Edit->Project Settings->Graphics and under "Always Included Shaders" section Add "UI Particles Add", then build and run your project.
Good evening,
Recently I was trying to create an app in Unity where with a button I could open an image or a pdf while the app remains open and running. I tried to do it with Unity, and I didn't see any problem. However, when I used the HoloLens emulator, every time I did it the app opens the file but then closes.
I thought that maybe if I defined several 2D Empty Objects (as Images, Raw Images...) the app would still run while doing this. To do this, I used the WWW class and the example of the Unity Scripting API.
https://docs.unity3d.com/ScriptReference/WWW.html
However, I don't know why when I run the app the Image doesn't change... I also tried the SetTexture() method it still doesn't work. So I was wondering if you have encountered the same problem, and if you could help me to solve it out.
Thanks a lot for your help!
Best Regards
I'd suggest looking up the following post: change texture
It comes down to defining a gameobject, making a prefab out of the Image and setting the material of the prefab. You can easily make new materials by importing an image or making one using projects tab>Create>Material. You could try making 2 Materials with different colors to test it.
It could also be code that needs to be run using UWP outside of the editor, if that's the case, you could use
#if !UNITY_EDITOR
//Put your code here.
#endif
I am creating a small custom 2D game engine and I am stuck setting up the orientation for my game.
I would like to use only LandscapeRight, therefore I set the PageOrientation and SupportedOrientation in my GamePage.xaml and in my graphics' PresentationParams to LandscapeRight, but after calling ApplyChanges, the orientation resets back to Portrait.
I even tried setting the BackBuffer width/height, setting the PreferredBackBuffer width/height, and tried calling/not calling ApplyChanges in my Game constructor, Initialize, LoadContent, etc methods, but no change in the orientation.
Can someone advise me how to set up orientation properly? I dont need complex solutions, some pseudo code would be more than enough as my game engine is separated into many small dlls.
Thanks in advance!
Finally I was able to solve the issue:
MonoGame 3.2.2. installer has corrupted template, so I deleted the old project that was created from the template and targeted Windows Phone 8.1, then created a new project, added MonoGame 3.2.2. libraries through NuGet, copied the MonoGame.dll into an 'Externals' folder and referenced it in the engine's class libraries. After rebuild all, orientation worked like a charm! :)