Our Unity Assets For Download!

FREE Tools To Help You Develop!

Download free animations to use with any humanoid rigged models!

Download tons of free sound effects to use in your game!

Download this free software to create 3D models for your games!


Download this free software to create amazing textures for your game!

Download this free software to takes screenshots of your work or record gameplay!

Use this free Windows software to edit and create game trailer videos!


Download this handy software to write C# scripts to use in Unity!

Use this handy tool to help you write AI code to use in Unity!

FREE C# Source Codes

What It Does

Calls an event when a certain object with a tag enters a 3D trigger.

How To Use

Drag the script to a 3D collider set to trigger. Set the tag of the object you want to collision.

Code Here!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

public class TriggerCustom : MonoBehaviour
{
public UnityEvent onEnterTrigger;
public string targetTag;

// Start is called before the first frame update
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == targetTag)
{
onEnterTrigger.Invoke();
}
}
}

What It Does

Teleports an object that enters a 3D trigger to any set position in the scene.

How To Use

Drag the script to a 3D collider set to trigger. Drag in object you want to teleport.

Code Here!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Teleport : MonoBehaviour
{
// Start is called before the first frame update
public GameObject Player;
public float xCoord;
public float yCoord;
public float zCoord;

public void MoveToCoordinates()
{
// Set objectToMove position to public coordinates
Player.transform.position = new Vector3(xCoord, yCoord, zCoord);
}
}

What It Does

Toggle an object on and off with a press of a key.

How To Use

Drag script anywhere. Drag in object you want to toggle. Set the key you want pressed.

Code Here!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ToggleWithKey
{

public GameObject objectToToggle;
public KeyCode toggleKey = KeyCode.Space;

void Update()
{
if (Input.GetKeyDown(toggleKey))
{
objectToToggle.SetActive(!objectToToggle.activeSelf);
}
}
}

What It Does

A simple enemy AI movement script that follows player and calls an attack function when close.

How To Use

Set the tag of your player object to "Player". Add a nav mesh agent to your enemy. Attach script to enemy.

Code Here!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;

public class enemymove : MonoBehaviour
{
private Transform player;

private NavMeshAgent agent;

public float enemyDistance = 0.7f;

private void Start()
{
player = GameObject.FindWithTag("Player").transform;

agent = GetComponent<NavMeshAgent>();
}

//Call every frame
void Update()
{
//Look at the player
transform.LookAt(player);

agent.SetDestination(player.transform.position);

//is close do attack
if (Vector3.Distance(transform.position, player.position) < enemyDistance)
{
gameObject.GetComponent<NavMeshAgent>().velocity = Vector3.zero;
}
}
}

What It Does

Makes an object face towards another object continuously.

How To Use

Drag the script on an object. Drag in the object you want to look at.

Code Here!

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LookAt : MonoBehaviour
{
public Transform target;

void Awake()
{
// Reset rotation
transform.rotation = Quaternion.Euler(0, 0, 0);
}

void LateUpdate()
{
// Get direction to player
Vector3 direction = target.position - transform.position;
direction.Normalize();

// Remove any rotation constraints
transform.rotation = Quaternion.Euler(0, 0, 0);

// Set rotation to face direction
transform.rotation = Quaternion.LookRotation(direction);
}
}