public void StartPlacing(BuildingGrid grid, int price) { _player.ObjectSelector.Deselect(); _player.CursorState = CursorStates.Placing; grid.transform.position = new Vector3(0.0f, -10000f, 0.0f);//установка созданного объекта в позицию, невидимую для игроков. PlaceableObjectGrid = grid; PlaceableObjectPrice = price; PlaceableObjectGrid.collider.isTrigger = true;//отключаем влиения объекта на физику в игре //Отключение AI, если есть var objectAI = PlaceableObjectGrid.GetComponent <BaseObjectAI>(); if (objectAI != null) { objectAI.enabled = false; } _materialChanger = PlaceableObjectGrid.GetComponent <MaterialChanger>(); if (_materialChanger != null) { _materialChanger.SetTransparent(0.6f); } //добавляем Rigidbody для работы с методами OnTrigger, OnCollision в BuildingGrid var objectRigidbody = PlaceableObjectGrid.GetComponent <Rigidbody>(); if (objectRigidbody == null) { _hasDefaultRigidbody = false; objectRigidbody = grid.gameObject.AddComponent <Rigidbody>(); objectRigidbody.isKinematic = true; } else { _hasDefaultRigidbody = true; } _placingMode = true; }