Привет! Я Денис и я делаю игры на Unity. В этом блоге я делюсь своим опытом в геймдеве и не только.
Навигация в закрепе: https://t.me/spellsingergames/3
Написать в личку: @sinedsem
Post #153
874

Хм, а это что такое?
- 👀 5
- 🤯 2
SP @spellsingergames
Showing posts older than #154 · Back to latest





using System.IO;
using System.IO.Compression;
using UnityEngine;
public class ZipFolderUtility
{
public static void ZipFolder(string folderPath)
{
if (!Directory.Exists(folderPath))
{
Debug.LogError("Folder does not exist: " + folderPath);
return;
}
var zipName = $"{Path.GetFileName(folderPath)}.zip";
var zipPath = $"{folderPath}/{zipName}";
var oldZipPath = $"{folderPath}/_{zipName}";
if (File.Exists(oldZipPath))
File.Delete(oldZipPath);
if (File.Exists(zipPath))
File.Move(zipPath, oldZipPath);
using var zipToOpen = new FileStream(zipPath, FileMode.Create);
using var archive = new ZipArchive(zipToOpen, ZipArchiveMode.Create);
var files = Directory.GetFiles(folderPath, "*", SearchOption.AllDirectories);
foreach (var filePath in files)
{
var entryName = filePath.Substring(folderPath.Length + 1).Replace("\\", "/");
if (entryName.EndsWith(zipName))
continue;
archive.CreateEntryFromFile(filePath, entryName);
}
Debug.Log("ZIP created: " + zipPath);
}
}
IL2CPP Code Generation = Faster (smaller) builds и Stripping Level = High.
python server.py --dir ./Build —-port 8080
python нужно писать python3
ParticleSystem.EmitParams можно указать положение, размер, вектор движения, время жизни и ещё несколько параметров, но не конкретный Sprite.var dimensions = 4;
var sprite = ...
particleSystem.Emit(new ParticleSystem.EmitParams
{
position = ...,
startSize = sprite.texture.width / sprite.pixelsPerUnit / dimensions,
startColor = new Color(sprite.rect.x / (sprite.rect.width * dimensions),
sprite.rect.y / (sprite.rect.height * dimensions), 0, 1),
velocity = ...
}, 1);



QuestService, который отвечает за все задания, и от него зависят все остальные сервисы, в которых что-то разблокируется по мере прохождения обучения.Foo, при этом сам этот сервис Foo зависел от QuestService. В итоге, при вычислении условия, код получал не проинициализированную до конца зависимость, и падал с NRE (NPE, прим. для моих коллег джавистов). Обиднее всего то, что баг был плавающий, и не воспроизвелся, когда я тестировал, поэтому он попал на все площадки, где есть наша игра, и нам срочно пришлось выпускать хотфикс.Constructor injection guarantees no circular dependencies between classes, which is generally a bad thing to do. Zenject does allow circular dependencies when using other injections types however such as method/field/property injection
dynamic_0, dynamic_1, ..., dynamic_Nfor (var i = 0; i < 100; i++)
{
var expression = Get($"dynamic_{i}");
if (string.IsNullOrWhiteSpace(expression))
break;
// apply configs
}
desert>Nitro.Levels[0].Cost=[50]
desert>). Это должен быть какой-то объект, на который у вас есть ссылка. У меня в проекте почти до любого параметра можно добраться через корневой объект, описывающий мир, поэтому desert - это идентификатор мира. У вас в проекте это может быть всё, что угодно.Nitro.Levels[0].Cost=[50]. В данном примере мы берем свойство Nitro корневого объекта, у него берем свойство Levels, обращаемся к 0 элементу массива Levels, и в свойство Cost, которое у меня является массивом int'ов, записываем значение [50].string, int, float и bool
SetDependenciesCommented("Assets/YandexMobileAds/Editor/YandexMobileadsDependencies.xml", true);public static void SetDependenciesCommented(string xml, bool value)
{
if (File.Exists(xml))
{
var content = File.ReadAllText(xml);
if (value)
{
content = Regex.Replace(content, "^<dependencies>(\r?\n)", "<dependencies><!--$1");
content = Regex.Replace(content, "(\r?\n)</dependencies>$", "$1--></dependencies>");
}
else
{
content = content.Replace("<dependencies><!--", "<dependencies>");
content = content.Replace("--></dependencies>", "</dependencies>");
}
File.WriteAllText(xml, content);
}
PlayServicesResolver.ResolveSync(false);
}