/// <inheritdoc/> public override ISensor[] CreateSensors() { DetectableGameObject.ClearCache(); ValidateGameObjectSettings(); if (m_GameObjectSettingsMeta.DetectableTags.Count > 0) { // Unlike GridSensorComponentBase, this component creates its own GridBuffer. // We use a ColorGridBuffer in order to support PNG compression. // GridShape is set by the 2D and 3D subcomponents prior to creating the buffer. GridBuffer = new ColorGridBuffer(GridShape); var sensors = base.CreateSensors(); if (Application.isPlaying) { // TODO It should be clearer which sensor features are enabled // in editor vs play mode. Detector/Encoder code is supposed to // be runtime only. m_GridSensor.EnableAutoDetection(CreateDetector(), CreateEncoder()); } return(sensors); } throw new UnityAgentsException("No detectable tags found! " + "Add a detectable gameobject to the inspector settings."); }
/// <inheritdoc/> public override ISensor[] CreateSensors() { if (GridBuffer == null) { // Create GridBuffer if none was provided. // The ColorGridBuffer supports PNG compression. GridShape.Validate(); GridBuffer = new ColorGridBuffer(GridShape); } return(base.CreateSensors()); }