Custom InnerNetObjects
Introducing Custom InnerNetObjects
This PR introduces a set of improvements to make working with custom InnerNetObject easier, and more intuitive. The changes include:
-
Comprehensive XML Documentation:
- Added detailed documentation for key methods to improve code clarity and developer experience.
- Examples and usage instructions are provided to help developers quickly integrate custom
InnerNetObjectprefabs.
-
Utility Methods for Prefab Handling:
- Added methods like
GetNetObjPrefab<T>,SpawnNewNetObject<T>, andSpawnNetObjectto simplify the process of retrieving, instantiating, and spawning customInnerNetObjectprefabs.
- Added methods like
Key Changes:
1. GetNetObjPrefab<T>
- Purpose: Retrieves the prefab for a custom
InnerNetObjectof typeT. - Usage:
var prefab = InnerNetObjectManager.GetNetObjPrefab<MyCustomObject>();
2. SpawnNewNetObject<T>
- Purpose: Spawns a new
InnerNetObjectlocally and on the network of type "T". - Usage:
var newObject = InnerNetObjectManager.SpawnNewNetObject<MyCustomObject>(ownerId: 1, spawnFlags: SpawnFlags.None);
3. SpawnNetObject<T> (Extension Method)
- Purpose: Spawns an existing
InnerNetObjectinstance on the network. - Usage:
var existingObject = new MyCustomObject(); existingObject.SpawnNetObject(ownerId: 1, spawnFlags: SpawnFlags.None);
i just dont get the InnerNetObject attribute, it seems really unecessary since this can be done by checking subtypes in the assembly
I think example class should be an actual simple example of what you can do with this instead of just a stub.
i just dont get the InnerNetObject attribute, it seems really unecessary since this can be done by checking subtypes in the assembly
The first reason is do to the issue with abstract monobehaviors and compiling it into il2cpp, second reason is I feel like it's more consistent using a attribute as the original class with Reactor, now I'm probably going to change the method of loading the prefab for it.
If y'all really want it to just be a custom subclass then I'll rework the logic.
i just dont get the InnerNetObject attribute, it seems really unecessary since this can be done by checking subtypes in the assembly
I've added some changes.