Unity Scripting with C# How to use contitional operation
Unity
Scripting with C#
How to use contitional operation
output:
Scripting with C#
How to use contitional operation
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Conditional : MonoBehaviour
{
public int score;
public bool CheckPoint;
void Update()
{
if (score == 50 && CheckPoint)
{
Debug.Log(" Score Is 50");
}
if (score == 40 && !CheckPoint)
{
Debug.Log (" Score is40");
}
else
{
Debug.Log (" Hi I Am Codding with unity");
}
}
void OnTiggerEnter(Collider other)
{
if (other.CompareTag ("Player"))
{
Debug.Log (" Score is 0");
}
}
}
No comments