Resources
Answers
Examples
Sign in
Get Started
What do you want to save?
Add Code snippet
New code examples
Other
2022-03-24 19:35:01
t
using UnityEngine; public class Enemy : MonoBehaviour { public float speed = 10f; private Transform target; private int wavepointIndex = 0; void Start () { target = Waypoints.points[0]; } void Update () { ...
Add solution
C#
2022-03-17 16:50:08
onmouseclick unity
using UnityEngine; using System.Collections; using UnityEngine.SceneManagement;public class ExampleClass : MonoBehaviour { void OnMouseDown() { // Destroy the gameObject after clicking on it Destroy(gameObject); } }
Add solution
C#
2022-03-01 01:40:14
unity singleton
#region Singleton void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); } #endregion
Add solution
C#
2022-02-24 14:20:18
how to make a destroy reference in unity
private void OnMouseDown() { Destroy(gameObject); }
Add solution
C#
2022-02-22 18:40:10
unity destroy gameobject
// To remove a GameObject use the function 'Destroy()' Destroy(gameObject);
Add solution
C#
2022-02-18 07:55:22
how to make a shooting enemy ai in c#
//Put this on your bullet prefab, and rename Player to what your character's name is. float moveSpeed = 7f; Rigidbody2D rb; Player target; Vector2 moveDirection; void Start() { rb = GetComponent<Rigidbody2D>(); ...
Add solution
C#
2022-01-23 05:35:27
unity remove gameobject
// To remove a GameObject use the function 'Destroy()' Destroy(gameObject);
Add solution
C#
2022-01-23 02:01:08
destroy the game object if the animator has finished its animation
// destroy the game object if the animator has finished its animation if (anim.GetCurrentAnimatorStateInfo(0).normalizedTime >= 1) { Destroy(gameObject); }
Add solution
C#
2021-11-18 16:46:18
photon how to destroy object
PhotonNetwork.Destroy(gameObject);
Add solution
C#
2021-11-06 20:31:16
how to make a singleton in unity
#region Singleton void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); } #endregion
Add solution
‹
1
2
›
Best helpers
daily
weekly
monthly
for 3 months
Ranking is empty
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.