Resources
Answers
Examples
Sign in
Get Started
What do you want to save?
Add Code snippet
New code examples
C#
2021-10-21 16:30:09
unity fall damage c#
using UnityEngine; public class Collisions : MonoBehaviour { [Tooltip("In Meters")]public float distanceAllowedToFall; float jumpHeight; float landingHeight; float fallDistance; private void OnCollisionExit(Collision colli...
Add solution
C#
2021-10-21 00:05:05
unity c# change color of gameobject
using UnityEngine; using System.Collections; public class collisionpill : MonoBehaviour { public Color mycolor; void OnCollisionEnter(Collision other) { if (other.transform.tag == "Pill") ...
Add solution
C#
2021-10-20 13:05:12
Triggers in unity
//for collision detection void OnCollisionEnter(Collision collision) { } // for use of triggering void OnTriggerEnter(Collider other) {}
Add solution
C#
2021-10-17 19:44:06
unity c# jump
using System.Collections; using System.Collections.Generic; using UnityEngine; public class jump : MonoBehaviour { public float jumpHeight = 7f; public bool isGrounded; public float NumberJumps = 0f; public float MaxJumps = 2; private...
Add solution
C#
2021-10-14 16:10:05
hwo to prevent rotation after hitting an object in unity
private void OnCollisionEnter(Collision collision) { GetComponent<RigidBody>().freezeRotation = true; }
Add solution
TypeScript
2021-10-03 10:57:02
unity how to make two objects not collide
void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "theobjectToIgnore") { Physics.IgnoreCollision(theobjectToIgnore.collider, collider); }
Add solution
Other
2021-09-29 12:53:02
oncollisionenter
void OnCollisionEnter(Collision col) { //This method will run when your game object //collides with something Debug.Log("Collided"); }
Add solution
C#
2021-09-20 08:35:02
prefab not destroying
public void OnCollisionEnter(Collision nameOfObject) { Destroy(nameOfObject.gameObject); }
Add solution
C#
2021-09-16 15:15:01
How to make an enemy unity
private void OnCollisionEnter(Collision collision) { if(collision.gameObject.tag == "Enemy") { Destroy(gameObject); }
Add solution
C#
2021-09-14 12:25:02
bounce script unity
void OnCollisionEnter(Collision collisionInfo){ rigidbody.AddForce(Vector3.Reflect(direction, collisionInfo.contacts[0].normal) * mag, ForceMode.Impulse); }
Add solution
‹
1
2
3
›
Best helpers
daily
weekly
monthly
for 3 months
Daniel Cooke
+5
AMACB
+5
show more
This website uses cookies to make IQCode work for you. By using this site, you agree to our
cookie policy
Welcome Back!
Sign up to unlock all of IQCode features:
Test your skills and track progress
Engage in comprehensive interactive courses
Commit to daily skill-enhancing challenges
Solve practical, real-world issues
Share your insights and learnings
Sign in
E-mail
Password
Recover lost password
Log in
Or log in with
Not registered?
Sign up takes less than a minute
Create a Free Account
Sign up to unlock all of IQCode features:
Test your skills and track progress
Engage in comprehensive interactive courses
Commit to daily skill-enhancing challenges
Solve practical, real-world issues
Share your insights and learnings
Sign up
Email
Password
Sign up for free
Or sign up with
By signing up, you agree to the
Terms and Conditions
and
Privacy Policy
. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.