Alone on Valentines? God you're pathetic. Thankfully, I can fix that for you by teaching you how to make any BB character love you!
Follow this tutorial on how to create a new item. I will make it as a box of chocolates to gift to our character of choice
Import a heart texture into the project files and set the Texture Type to Sprite
Create a new Material and set the shader to Unlit/Transparent
Assign the heart sprite into the material
Create a new variable at the top of the GameControllerScript
[SerializeField] private Material heartMat;
Assign the newly made material into the GameControllerScript
This will be the material for the hearts that will pop out soon
Copy the following code and paste it in the UseItem function
Ray ray4 = Camera.main.ScreenPointToRay(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2), 0f));
RaycastHit raycastHit4;
if (Physics.Raycast(ray4, out raycastHit4) && Vector3.Distance(this.playerTransform.position, raycastHit4.transform.position) <= 10f & (raycastHit4.transform.CompareTag("NPC")))
{
ParticleSystem hearts = raycastHit4.transform.gameObject.AddComponent<ParticleSystem>();
hearts.Stop();
// Main
var main = hearts.main;
main.duration = 0f;
main.loop = false;
main.startLifetime = 1f;
main.startSpeed = 10f;
// Emission
var emission = hearts.emission;
emission.SetBursts(
new ParticleSystem.Burst[] {
new ParticleSystem.Burst(0f, 30)
});
// Shape
var shape = hearts.shape;
shape.shapeType = ParticleSystemShapeType.Sphere;
// Renderer
var render = hearts.GetComponent<ParticleSystemRenderer>();
render.material = heartMat;
hearts.Play();
Destroy(hearts, 1f);
this.ResetItem();
}
This will create the heart particles for when you gift an NPC the item
And there you go! Gift this item to an NPC of your choice and they will love you for it!
Note: This tutorial is just a joke I quickly made for Valentines day. This took me 2 hours to create from conception, execution, testing, and creating this webpage