Hi, Im creating a dictionary, but my type of dictionary i don’t know how to create values.
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Vuforia
{
public class SpawnZone : MonoBehaviour
{
Dictionary <Vector3, bool> isZoneEmpty = new Dictionary<Vector3, bool>();
}
}
\
Can anyone tell me how to create value for that.
Dictionaries don’t create keys/values, they just store them. You need to create the values yourself and then add them to the dictionary like:
Vector3 someVector3 = new Vector3(0f, 10f, 0f);
bool someBool = true;
isZoneEmpty.Add(someVector3, someBool);
isZoneEmpty.Add(Vector3.forward, true);
… or something. This is a very fundamental C# question, so maybe you should go find a book or some tutorials on C# before trying your hand at Unity development.