Hello all!
My first time, be gentle…
I have a script, with 2 classes;
In 1 class, I have a public bool, which appears in the inspector.
In the other class, I want to make an If statement, depending on the value of aforementioned bool.
3 hours later and still not any wiser, I figured to pop the question here.
My code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
[System.Serializable]
public class Wave
{
public bool mobTypeSoldier;
}
public class SpawnSoldier : MonoBehaviour {
public Wave mobType;
Void Update ()
{
if (mobType.mobTypeSoldier == true)
Debug.Log("Soldier Assigned");
}
So the idea should be, I select in the inspector the checkbox (mob Type Soldier), and the debug log writes “Soldier Assigned”. It doesn’t need to be at runtime; Simply configuring it before the game starts should be enough.
Thanks so much in advance!