private MapObject SpawnObject(string modelName, Vector3 position, Vector3 rotation) { Entity entity; if (modelName.StartsWith("0x")) { if (int.TryParse(modelName.Substring(2), NumberStyles.HexNumber, new NumberFormatInfo(), out var modelHash)) { entity = NativeUtility.CreateObject(modelHash, position); } else { NativeUtility.UserFriendlyPrint($"Failed to spawn \"{modelName}\""); return(null); } } else { entity = NativeUtility.CreateObject(modelName, position); } NativeUtility.SetEntityRotation(entity, rotation); var spawnedObject = new MapObject(modelName, position, rotation, entity); if (entity == null) { NativeUtility.UserFriendlyPrint($"Failed to spawn \"{modelName}\""); return(null); } _spawnedObjects.Add(spawnedObject); _selectedMapObject = spawnedObject; NativeUtility.UserFriendlyPrint($"Created \"{modelName}\""); return(spawnedObject); }