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.
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 built a portal shader and it required me to use Lightweight Render Pipeline. i upgraded all the object materials to lightweight materials and i created a lightweight renderrer pipeline and put it in the graphics settings. Althoug,still some of the objects are pink. is there any way to fix it?
Thank you
I did what they said in "Lightweight Render Pipeline in Unity turned everything pink" but still then some of the objects left pink.
Sorry about this short qeustion, i am new at it. If you dont unsderstand my question feel free to ask
Edit:
Ruzihm solution was working for me, thanks him :D
You are using shaders that are incompatible with the LWRP. The Unity Editor can try to automatically replace them with compatible ones. In the menu, do Edit -> Render Pipeline -> Upgrade Project Materials to LightweightRP Materials, and then Unity will do its best to upgrade the materials/shaders.
This may be only a partial solution depending on if Unity can find a suitable replacement for all of your shaders or not.
For the ones Unity can't or won't upgrade, you can try configuring them with default LWRP shaders by inspecting the material on those objects, clicking Shader, and then selecting Lightweight Render Pipeline > Lit or Lightweight Render Pipeline > Unlit depending on if you want lighting effects or not.
For the terrain, you can replace its current material with the TerrainLit material:
Where to set it:
Where to find it:
[images source]
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?
Everyone.
Vuforia Camera does not work, but only black screen on Android 6.0+ versions.
Vuforia Version is 6.2.2 and Unity version is 5.4.4
But vuforia camera works on less than android 5.0
How can I fix this issues?
I hope you to teach me about this.
This is an interesting problem I have and there is an unacceptable temporary fix I am using while testing this system out. For the iPhone 7, to get past this suspend the app and then return to it. After about 2 seconds the camera will work. I am guessing it will work similar for android. I will update with a better fix if I come by a real fix after my testing if I decide to use this system.
Edit:
Short answer:
Delete the meta data for any pre-existing custom camera controller script. If you are using your own camera controller you need to disable the vuforia one and delete the meta for that. You are basically hijacking the camera feed after it starts.
long: I began this application by building out my own system and to test vuforia I disabled these items (like the camera feed). I went through the logs and saw that even with these items disabled the camera feed was still running and this feed started AFTER the vuforia camera so basically my own start() methods (even though they were disabled) were hijacking the camera from vuforia. It turns out that my meta data for my camera controller script was still poised to run the script even though everything was disabled. After deleting my camera controller script meta data it worked fine. You can also just delete the camera controller and it will delete the meta. By camera controller I mean my custom written camera controller that was built before I added in vuforia. This is a hard to find fix because it works fine in unity, but not when you build out to a device. The meta doesn't seem to update for the device, just the unity engine.
If you are using the vuforia camera make sure you either use the vuforia plane that comes as a child of the camera or delete the meta data to whatever camera script you wrote. You should get camera feed in a new empty project just by dropping in the vuforia camera, there is no need to build your own script and if you do, make sure one isn't overriding the other like mine was.
If you want to simply test to make sure it isn't your device or code create a NEW empty unity project, import vuforia (no need to import the database, just the sdk) and then drop the vuforia camera into the project and test it. Don't add anything extra or do any image recognition. If this works, it's your code somewhere.
I am using Vuforia 6.2.10, Unity 5.4.4.f(64 bit) and a Nexus 7 Android 6. I had the same issue where the camera was black. I started over, adding one component at a time. The AR Camera alone worked fine. Adding a Target Image also worked. I added a plane and image to the TI and the camera failed to work. Setting the image texture type to Sprite 2d and ui seemed to help.
I discovered that by deleting the app from the device and creating a apk file each time it worked.
I am not sure I'd count on Vuforia in the near term.
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! :)