Simpel And Free To Use C# Scripts
3d move towards target C# script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NameOfYoureScript : MonoBehaviour
{
public Transform target;
public float WalkingSpeed = 4f;
Rigidbody rig;
//By CreativeGaming.se
void Start()
{
rig = GetComponent<Rigidbody>();
}
void FixedUpdate()
{
Vector3 pos = Vector3.MoveTowards(transform.position, target.position, WalkingSpeed * Time.fixedDeltaTime);
rig.MovePosition(pos);
transform.LookAt(target);
}
}
simpel object switching script
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NameOfYoureScript: MonoBehaviour
{
public GameObject[] wepons;
int weponCounter = 0;
//By CreativeGaming.se
void Start()
{
wepons[0].SetActive(true);
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Alpha1))
{
weponCounter = 0;
for (int i = 0;i<wepons.Length;i++)
{
if (i != weponCounter)
wepons[i].SetActive(false);
else
wepons[i].SetActive(true);
}
}
else if (Input.GetKeyDown(KeyCode.Alpha2))
{
weponCounter = 1;
for (int i = 0; i < wepons.Length; i++)
{
if (i != weponCounter)
wepons[i].SetActive(false);
else
wepons[i].SetActive(true);
}
}
}
}
super simpel on collide = destroy script works with any gameobject
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
//by CreativeGaming.se
public class NameOfYoureScript : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
Destroy(gameObject);
}
}