So, I’m new to Unity and c# so I’m not the greatest, but willing to learn.
I’m trying to make a simple script so when you put two objects together, the create something new. For example, a bottle of water and an ingredient makes a potion.
I need a way to create a new object (the potion in this case) and delete the two ingredients. So far, I have this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Brew1 : MonoBehaviour {
void OnCollisionEnter(Collision col)
{
if(col.gameObject.name == "ing_sphere")
{
Destroy(col.gameObject);
Destroy(gameObject);
}
}
}
Which does what I want it to, except for creating the new object. I’ve tried messing around with Instantiate and I can’t seem to get it to summon a new object from the project files. How would I get it to summon a new object after deleting the first two?
Thanks in advance.