- Home /
Question by
einstienalbert787 · Apr 11, 2019 at 12:25 AM ·
unity 5c# tutorial
Can you guys help, I basically want to collide 2 game objects to initiate the third one, for example when I drag the pasta on plate these two object will destroy then pasta outcome will initiate..
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class Manager : Singleton { protected Manager() { } // guarantee this will be always a singleton only - can't use the constructor!
public GameObject Plate;
public GameObject Pasta;
public GameObject PastaOutcome;
public void InstantiateNewCube(MyCubeClass cubeOne, MyCubeClass cubetwo, Vector3 position)
{
if (cubeOne.color == "blue" && cubetwo.color == "yellow")
{
Instantiate(greenCube, position, Quaternion.identity);
}
//you need more methodes here for each fusion scenario of colors
}
}//the code is not mine, I just use it as reference
Comment
Answer by cs120319992 · Apr 11, 2019 at 09:20 AM
Use methods OnCollisionEnter, or OnColliderEnter, 2d or 3d
Your answer
![](https://koobas.hobune.stream/wayback/20220612195230im_/https://answers.unity.com/themes/thub/images/avi.jpg)