Nothing showing in playmode - c#

My script is running fine and had been showing the game up in play mode (but not in scene view) up until I finished the script and now it has disappeared and I can't seem to find it in either.
I made sure I was in orthographic view, tried messing with the near and far values of the clipping planes in the main camera and made sure all assets in the scene including the gameobject housing the script were positioned at 0 on all axis. I can't find it at all anymore, aside from when pressing pause in play mode but then I can't test the interactions.
This is what I see when I enter play mode
This is what I see when I hit pause
it's supposed to be shuffled at the beginning so that part seems right as it is a different order every time I try this

Move the camera back 10 units on the z. Cameras have a view frustum, where elements outside it won't render. This is what is happening here. With the near plane set to 0.3, you need to move the camera away from an object by 0.3 units. The default z value is -10 on the camera.
https://docs.unity3d.com/ScriptReference/Camera-nearClipPlane.html

Related

Scaling Movement in unity VR with oculus headset

There seems to be an issue when i am using VR. The movement I make is not scaled correctly with the movement in the VR. I have to move much further in reality to go where I need to in VR. I am working on the reach with the OVRgrabbable script after finding something online that may help. I am having an issue with getting the X,Y axis to be recognized as objects. Everything else about the code seems to be ok as nothing else is underlined in red.
This image is the notif. i am getting. I am just referencing the x and y axis i think it should operate just fine
I have one suggestion, on the OVRCustomHand.prefab check the configurations on the script OVRCustomSkeleton.cs:
Make sure to check the checkboxes for Update Root Pose (only if your OVRHandPrefab is not parented to OVRCameraRig), Update Root Scale (makes the hand model size is scaled either up or down based on the user’s actual hand size), Apply Bone Translation.
This will make sure the Hand's position is referenced to your scene's global space instead of real tracking space.
Hope it works!

Skybox Renders in Unity but anything else doesn't

sorry if the solution is quite obvious but I'm still a learning student.
I'm teaching myself on the side by making a 2D game and was working with Unity but got stuck when I noticed the Game screen and the Camera Preview display the game properly, but the moment I run it, it only shows the Skybox and nothing else in front of that... The Main Camera is behind the Background so I'm a lil confused why it only renders the Skybox.. any advice?
I put some pics below as an example of the settings (yes the camera follows the player and some usages are a bit outdated)
After another look, and close inspection, I would like to point you at where your objects are actually located, your max and min for your camera is: -4 and 0.66 your BG and your camera are starting at -100 something. so when the game starts your camera is moving to -4 from -110 that is why you cannot see them.

Particles not appearing in Unity

I have made a smoke particle effect that I instantiate everytime the player shoots, its working but can not be seen with the background. If I delete the background it's visible, I've tried changing the ordering layer, creating a new layer and putting it above the default, but no matter what it's still below the background. Any ideas?
Assuming you are developping a 2D game, you can use the z axis to set the distance of the elements to the camera (what will be the equivalent to the order of render)
Usually in a 2D game you will have the main camera at -10 in the z axis. So moving in the inspector the backgroun to, lets say z=5 or z=10, and keeping in you particle system in z=0 should solve your problem.
Try this easy trick and let me know if you are still facing problems.
You can check the second half of this video for a better understanding
Also, if you are making a 3D game you can go to the material of the particles and make sure that render face is set to both. I just had that problem and it was annoying me. but that fixed it.

Set limit camera screen WITDH

Look my game has a fixed camera, configured as a standard 1280x720.
I placed at each end of the cam width of an empty object with a collider to prevent the player pass this point.
Everything works perfectly until the default resolution decreases. When I run the test with 480x320 screen width decreases, but the collider, does not follow this decrease, staying out of the screen, which makes the player to be "cut off."
The following two images:
First: 1280x720
Second: 480x320
There is some way which I can only set the side margins left and right of the camera as a collider?
If it is not possible to configure only the edge of the camera as a delimiter, the player would have some other way to do something to solve my problem?
Some items fall from the sky, so I can not have a collider at the top of the camera.
There are many ways to do this. The easiest way is to create a 4 box collider 2D and position them to the edge of the screen.
I always use this complete script to do this. It's too long to post here. Just attach it to an empty GameObject in the scene. It will do the rest of the work for you. I will create the colliders and position them to the edge of the scrren automatically.
As what i have understand my be this can help you
Scale box collider to camera view

How do I make so when user moves the camera it doesn't go beyond the scene borders?

How do I make so when I move the camera(with touch) it doesn't go beyond the scene borders?
How do I move the camera with touch so it moves strictly with scene parts, like slides(swipe-first slide, another swipe-another slide) with not going beyond the borders of the scene?
The game I'm making has a camera like in Disco Zoo game for android (I'm a newbie)
Technically, the scene doesn't really have a border. You'll need to define the border somehow within your game, then constrain the camera's position with something like Mathf.Clamp(value, min, max) in an Update() function on the camera.
How can you define the border? It's up to you. Some ideas:
Hard-code the values in the script that clamps the camera. Probably the quickest option, but not flexible
Make public parameters on the camera script that let you set min and max positions in the X and Y directions
If you have a background image: use the extents of that to define your camera's extents
Create empty objects in your scene that define the minimum and maximum extents of the scene. Put your "min" object at the top-left, and the "max" object at the top-right. Connect it to the camera script, then use those positions to see if you've gone too far in any given direction. The main reason to do this is that it's visual.
(Slower, but dynamic) If everything in your scene uses physics, you could search the entire scene for every Collider component, then find the furthest extents in each direction. However, this is probably going to be pretty slow (so you'll only want to do it once), it'll take a while to code, and you'll probably want to tweak the boundaries by hand anyway.

Categories