- Home /
Skipped updating the transform of this rigidbody because its components are infinte, could you have applied infinite forces, acceleration or set huge velocity?
I'm making a simple game and this error keeps showing up and then just stops me from playing my game: Skipped updating the transform of this rigidbody because its components are infinte, could you have applied infinite forces, acceleration or set huge velocity?
please help!
@justinsykes2006 Please share the exact code line in which this error occurs, and mark it for us -- and also share some of its surrounding code.
Answer by justinsykes2006 · Mar 14, 2020 at 01:38 PM
@JPhilipp Heres the script and I think its talking about a cylinder object
using UnityEngine;
public class PlayerCollision : MonoBehaviour{
public PlayerMovement movement;
public Rigidbody rb;
void OnCollisionEnter (Collision collisionInfo)
{
if (collisionInfo.collider.tag == "Obstacle")
{
movement.enabled = false;
FindObjectOfType<GameManager>().EndGame();
FindObjectOfType<AudioManager>().Play("PlayerDeath");
}
}
}
heres another one this is the GameManager
using UnityEngine; using UnityEngine.SceneManagement;
public class GameManager : MonoBehaviour {
bool gameHasEnded = false;
public float restartDelay = 100f;
public GameObject completeLevelUI;
public void CompleteLevel ()
{
completeLevelUI.SetActive(true);
}
public void EndGame ()
{
if (gameHasEnded == false)
{
gameHasEnded = true;
Debug.Log("Game Over");
Invoke("Restart", restartDelay);
// Restart Game
}
}
void Restart ()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}
}
And there was another problem, in the error list at the script it says : The type or Namespace name 'sound' could not be found (are you missing a using directive or an assembly reference?)
using UnityEngine.Audio; using System; using UnityEngine;
public class AudioManager : MonoBehaviour { public Sound[] sounds;
public static AudioManager instance;
// Use this for initialization
void Awake () {
if (instance == null)
instance = this;
else
{
Destroy(gameObject);
return;
}
DontDestroyOnLoad(gameObject);
foreach (Sound s in sounds)
{
s.source = gameObject.AddComponent<AudioSource>();
s.source.clip = s.clip;
s.source.volume = s.volume;
s.source.pitch = s.pitch;
s.source.loop = s.loop;
}
}
public void Play (string name)
{
Sound s = Array.Find(sounds, sound => sound.name == name);
if (s == null)
{
Debug.LogWarning("Sound: " + name + " not found!");
return;
}
s.source.Play();
}
void Start ()
{
Play("Song");
}
}
Can you post your solution to help others =(
Answer by okan92topal · May 05, 2021 at 10:24 PM
Check your collider's radius. You may have changed in update method ? You probably changed your collider's radius and it's going to infinite. This can lead to collide everything at the same time in your scene. That's why you got that error.
Your answer
Follow this Question
Related Questions
Horrible Console Spam... no ideas!! PLEASE HELP! 1 Answer
4 time stamps console error 0 Answers
Uma Power Tools/Recipe Tools compile errors 1 Answer
Console game isn't working. 0 Answers