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);
}
}

What It Does

How To Use

Creates a hint displaying system to your game.

Drag script on object. Drag in the hint text and hint object displayer in the script.

Code Here!

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

public class HintSystem : MonoBehaviour
{
public TMP_Text hintText;
public List<string> hints = new List<string>();
private int currentHintIndex = 0;

private bool HintBool;

public GameObject HintsBox;

void Start()
{
int value = PlayerPrefs.GetInt("Hint" + gameObject.transform.position);
HintBool = value == 1;

StartCoroutine(ShowHints());

if (PlayerPrefs.HasKey("Hint" + gameObject.transform.position))
{
HintsBox.SetActive(false);
}
}

IEnumerator ShowHints()
{
while (currentHintIndex < hints.Count)
{
hintText.text = hints[currentHintIndex];
currentHintIndex++;
yield return new WaitForSeconds(10f); // Adjust the delay between hints
}

// Call a function when the last hint is displayed
CallFunctionAfterLastHint();
}

void CallFunctionAfterLastHint()
{
// Add your function call here
Debug.Log("All hints have been displayed.");
HintsBox.SetActive(false);

PlayerPrefs.SetInt("Hint" + gameObject.transform.position, HintBool ? 1 : 0);
}
}