Hellow, i am facing a problem in my unity project. There is a scene in which rigidbody starts shivering / shaking on play and even in the editor (during playmod). Its a very little bit countinuous and irritating. First I thought that it might be an issue with any of my script / camera. So i tried without scripts and camera but shivering still happening. Shivering happening in just scene "A" only but works fine when I create new scene and place that prefab in new Scene. But most weirdest thing is that when i place the rigidbody prefab in another scene then it works absolutely fine and when I copy the same rigidbody from scene "A" to scene "B" then shivering starts in "B" scene too. I have noticed that problem might pertains to "Wheel Colliders" of my vehicle controller script because when I make them "hidden" / if I disable the "vehiclecontroller" component shivering stops.
please give any advice / suggestions.
below is a short visual of my problem.
Related
I'm making an online game with Photon in unity, everything is going well, but at the last moment I faced an unexpected problem.
I have a prefab object (tank) and I throw other prefab objects into this object, but it doesn't work, but it works when I put my object (tank) in the hierarchy as prefab and throw my other objects into my object (tank) as they are not prefabs.
For example, I want to make my game a mobile platform game, so I downloaded and added a joystick from unity asset store to my game.
If I assign this joystick to the movement script of my tank with the prefabs state, it does not work, but if I assign it to the movement script of my tank from the hierarchy part, it works.
What do you think is the reason for this, any ideas?
Edit, Instead of matching prefab objects from the inspector, joystick = GameObject.Find("Floating Joystick").GetComponent<FloatingJoystick>();` I matched it with my script file and it worked as I don't know why, but only the joystick in the hierarchy section worked, my fire button and camera tracking codes did not work. I think the reason is the connection I made with Photon, when connecting to photon, it is connected as server>loby>room, so the Start method works once until connecting to the room and it cannot find the specified object in the active scene. I have no idea how to solve this
sorry, my english is still bad so i use translate.
I think what you're saying is that you're assigning other prefabs to object slots in a script attached to your tank prefab.
If you do this when you're in prefab edit mode, then all your references to other prefabs are null when you instantiate the tank.
If you instantiate the tank in Edit mode, instantiate some other prefabs, and then make your assignments, then it works.
This is my understanding of your situation, at least. If this is right, the issue you're having with editing the prefab is that other objects are also prefabs, they're not instantiated.
You should be able to fix this by dragging the other prefabs onto your tank prefab, to instantiate them in the tank prefab, then drag those instantiated prefabs into your script slots.
As with basically everything in programming there are many other ways you can solve this, too, but this sounds the most like what you're looking for.
Hey i am working on VR application with unity. I have got some scenes in my project. Everythings are fine first scenes. There is a level i am using a "Player" prefab and when i start a load new scene with SteamVR_LoadLevel .Begin function, next scene loading finely and my HMD running good but the controllers freeze. I am CameraRig in next scene and i destroy Player [SteamVR] gameobject before scene with checkbox (unchecked) inside of inspector.
I was try Unity SceneManagement, or other things but i can not find a solution. By the way if i run that scene directly, every controller working fine.
Waiting your answers thank you.
I can not find solution on this problem but i change my GameObjects. I think if you use Player prefab previous scene and if you use CameraRig inside next scene then controllers freezing. Because vr action setup not same (or broken) for CameraRig. When i realized this situation, i change my CameraRig object to Player prefab. If you accept, this is my solution.
I'm a Computer Science
Engineering student. I'm currently working on a Uni project using Unity to build a 2D game. Until this morning everything was fine, but suddenly after some work on a UI Manager Script in my menu scene (Scene 0) when I tried to play the game some gameobjects (apparently random) stopped to be visualized on Scene View and on Game View in the Level scene (Scene 1).
I can see all gameobjects fine on camera preview and they all are active in the hierarchy, even all colliders are working.
I tried to look on the web, but I can't find any solution or any similar case...
I don't really have any ideas, I'll be really glad if someone can help me. Thanks.
Check the Material variable on the Sprite Renderer component and make sure it's set to "Sprites-Default". In my case, the material for the hidden objects had somehow changed to "None" while I was working on a little postprocessing effect.
Edit: Here's how the material changed. Adding a SpriteGlow script from a package which works with postprocessing had first turned the objects' SpriteRenderer material from the original "Sprites-Default" to "Sprite/Outline". Upon removing the SpriteGlow script component from the object, the material became "None" rather than defaulting back to "Sprites-Default" and that was when I stopped seeing the objects even though they were present in the scene. This is most likely your problem too since you said every other thing like collision works and the objects are definitely present in the scene.
when I reload a game scene by clicking on play again button in Unity , the game view automatically gets dark as if the skybox lighting settings are not set at all.
The game scene plays fine for the first time , the file was saved and when trying to replay the same again,the light settings go off. Is it a lighting bug in Unity 5 version?
I had the same problem and fixed it by unticking "Auto" (for automatic baking of light maps) in Window>Lighting>Scene and clicking "Build".
The same problem is answered on the Unity website
I also had the same issue. Turn off Baked Global Illumination in Mixed Lighting section.
Check if you are Destroy()ing objects you are not supposed to destroy.
You might for example have this case:
public class LightInstantiator : MonoBehaviour
{
public GameObject lightPrefab;
private GameObject mySceneLight;
void Start()
{
mySceneLight = Instantiate(lightPrefab);
}
void OnDestroy()
{
DestroyImmediate(lightPrefab); // BUG: you destroy the Prefab instead of the instance
}
}
This example script instantiates the Scene light for me, and destroys it again when itself is destroyed. This is perfectly legit, but I accidentally have introduced a bug: where I meant to destroy the instantiated light (mySceneLight) I actually destroy the Prefab.
On first start everything seems fine, light and all. When stopping and restarting the scene however, Unity will feed the (previously destroyed) Prefab into my script, which will then be unable to instantiate a functioning light: the scene stays dark.
Something along these lines happened to me once. I don't know if this is still possible, but it might be worth a check.
Afterthought:
It may even be easier. You might accidentally modify the prefab light in code by setting its intensity to 0 during your first run. As it is a prefab, Unity might not reset that, and on your second run, the prefab light intensity is still 0.
In a test scene with a locomotion character, when I attach a SmoothFollow script to the character, it works as it should, but when I use Oculus Rift to view the scene in VR, it no longer follows the character as it walks...
I am aware that the camera transform is over-ridden with the head-tracked pose, and that if I want to move the camera, I must attach it as a child to another game object and then move the root game object, but doing so still would not let me follow the character in VR.
Am I missing something, or is it not possible to have this in Oculus Rift where you can just make the character walk and you automatically follow it?
It sounds like you are close. Did you attach the SmoothFollow script to the new GameObject (parent of the camera) rather than the camera itself?
Also, you may want to comment out the part of SmoothFollow where it sets the rotation of the camera - this can be very disorienting in VR.