How to trigger NGO CodeGen via custom buildpipeline?
Mantenedores costumam responder em até 2 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 25/100
- Tipo de issue
- Funcionalidade
- Clareza
- Precisa de esclarecimento
- Status de atividade
- Estagnada
- Domínio
- game-dev, networking
Direção de pesquisa
Comece por Editor/CodeGen/NetworkBehaviourILPP.cs e pelo exemplo de UMod BuildProcessor na issue. Determine se o NGO CodeGen pode processar assemblies produzidos por esse pipeline de build personalizado e documente um caminho de integração compatível ou a limitação, caso isso não seja possível.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
This is a long shot and I'm assuming/guessing things based on what I have researched.
I also know I'm pushing the limits here - but hey somebody have to do it :)
Background
The background for this is that my game supports mods and I'm currently working on adding multiplayer to my game using NGO.
So far things are going pretty good - but there is one major issue I still haven't figured out and it's a really big deal as mod creators will be very limited if I can't get this to work.
I'm using UMod to help support mods in my game (https://assetstore.unity.com/packages/tools/integration/umod-2-0-58293).
As far as I understand, it adds feature on top and around Asset Bundles.
The way UMod work is pretty nice.
As the developer of the game (me) I setup various things, like what scripts should be included in the "Mod Tools" and other settings. I then build the "Mod Tools" for my game from inside Unity. This result in a .unitypackage file.
As the mod creators (people from the community) you then open up a fresh Unity and import this .unitypackage file (Mod Tools) and get some Unity windows to create a "mod" and can then build a mod - which can include custom scripts.
The mod creator then "build mod" from a custom Unity menu made by UMod, which generates a .mod file that the game can then pick up. At least simply put - the important part here is the UMod builds the mod here. Remember that.
The problem
So, I have discovered that ClientRPCs, ServerRPCs and NetworkVariables are NOT working if a modder is using it in his custom scripts.
I have done some research that indicates (and here comes the guessing part) that NGO is doing some CodeGen at "game build time" - I guess here: https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/blob/develop/com.unity.netcode.gameobjects/Editor/CodeGen/NetworkBehaviourILPP.cs
I'm guessing that it doesn't work, because this CodeGen is not happening on the custom scripts in the mod when it's build by UMod.
UMod supports custom BuildProcessors to run custom code when building the mods like this:
using System.Collections.Generic;
using UMod.BuildEngine;
using UMod.BuildPipeline;
using UMod.BuildPipeline.Build;
using UMod.Shared.Resources;
using UnityEngine;
// Add a build processor for script assets since we are only interested in scripts that will be compiled by uMod.
// High priority means that it will run after script compilation so build assemblies collection will already be filled out with compiled assemblies.
[UModBuildProcessor(".cs", 1000, true)]
public class PatchAssembliesExample : BuildEngineProcessor
{
// Methods
// Called by the build engine just after compilation if the mod includes any script content, passing all script assets as a parameter (Not interested in those).
public override void ProcessAssetBatch(BuildContext context, IEnumerable<BuildPipelineAsset> assets)
{
// get assemblies
ModAssemblyEntry[] entries = context.BuildAssemblies.Assemblies;
// Patch all
foreach(ModAssemblyEntry entry in entries)
{
PatchAssembly(context, entry);
}
}
private void PatchAssembly(BuildContext context, ModAssemblyEntry entry)
{
// Name info
string asmName = entry.AssemblyName;
// Get assembly image - loadable by 'Assembly.Load'
byte[] asmImage = entry.AssemblyImage;
// TODO - Run custom patcher code
// Get the patched result
byte[] asmImagePatched = ...;
// Check for patched
if (asmImagePatched != null)
{
// Remove original assembly
context.BuildAssemblies.RemoveFromBuild(entry);
// Register new assembly
if (context.BuildAssemblies.RegisterAssemblyForBuild(asmImagePatched, true) == false)
Debug.LogWarning("Failed to register patches assembly for build! : " + asmName);
}
}
}
So, here comes the million dollar question that will make the sky the limits for modders of my game - how can I trigger this CodeGen for the scripts in the mod?
Note that NGO is installed as a dependency to the Mod Tools, so NGO is installed in the mod creators Unity project.
- Linguagem predominante
- C#
- Estrelas
- 2.3k
- Forks
- 464
- Merge médio
- 2d 18h
- PRs com merge (30d)
- 15
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de Unity-Technologies/com.unity.netcode.gameobjects
-
NetworkList changes made since the last tick are applied twice on a newly synchronized clientAbertastat:awaiting-triage stat:reply-needed type:bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
Unity-Technologies/com.unity.netcode.gameobjects#4179 ·
Mantenedores costumam responder em até 2 dias
-
Dedicated server: mixed-authority NetworkObject is removed from NetworkTransformUpdate, so its owner-authoritative NetworkTransform never updates server-sideTalvez já em andamento @NoelStephensUnity assumiu há 11 dias. Abertastat:imported stat:reply-needed type:bug
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 68/100
Unity-Technologies/com.unity.netcode.gameobjects#4159 · 5 comentários ·
Mantenedores costumam responder em até 2 dias
-
NetworkAnimator: Conditional triggered transitions to Exit node log false errorsTalvez já em andamento @NoelStephensUnity assumiu há 196 dias. Abertastat:awaiting-response stat:awaiting-triage stat:Investigating type:bug
Unity-Technologies/com.unity.netcode.gameobjects#3912 · 7 comentários · 1 responsável ·
Mantenedores costumam responder em até 2 dias
-
Tracking type:feature-2.x
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 35/100
Unity-Technologies/com.unity.netcode.gameobjects#3870 · 5 comentários ·
Mantenedores costumam responder em até 2 dias
-
Tracking type:feature
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
Unity-Technologies/com.unity.netcode.gameobjects#3830 · 7 comentários ·
Mantenedores costumam responder em até 2 dias
Todas as issues de Unity-Technologies/com.unity.netcode.gameobjects
Issues semelhantes
-
[Doc Gap] Document new --enable-public-network-access breaking change for azurebackup vault createAbertacopilot documentation
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
Mantenedores costumam responder em até 1 dia
-
area-dashboard
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
Mantenedores costumam responder em até 1 dia
-
0 - Backlog Bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
BrighterCommand/Brighter#4539 ·
Mantenedores costumam responder em até 1 dia
-
area-networking
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
dotnet/aspnetcore#69671 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
test
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
NethermindEth/nethermind#14274 ·
Mantenedores costumam responder em até 1 dia