npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

il2cpp-bridge-abstractor

v1.0.5

Published

Abstracts common C# and Unity objects, including GameObjects, MonoBehaviours and Dictionaries. And additional helper methods to check for equality, print a tree of GameObjects, etc.

Downloads

7

Readme

Note: This repo is meant for a personal project, you're welcome to use it but I encourage you to make a fork or just make your own.

This repo is subject to change at any time, with or without notice.

Design structure

Currently the code is sortof a mess, I'm working on cleaning it up and making it more modular. The planned structure is as follows:

Base Design

AbstractedObject is the base class for all abstracted objects.

AbstractedObject Design

native is the property that is used to reference the Il2Cpp.Object that the abstraction is linked to, while inside the class. object is the getter for native and is readonly and public. constructor is the constructor for the class, it takes a native object as a parameter and links the abstraction to it. abstractify is an alias for constructor, and for the sake of consistency, it is recommended to use abstractify instead of constructor.

Design Guide for Classes that inherit from AbstractedObject

Note: If you're trying to abstract a C# struct, read the next part instead. Note: Abstraction should only be used on objects that are instances of NativeStruct, otherwise it would be unnecessary.

  1. All classes that inherit from AbstractedObject should override the native and object properties to suit their needs. For example, AbstractedArray overrides native to be an Il2Cpp.Array instead of an Il2Cpp.Object.
  2. All classes that inherit from AbstractedObject should override the constructor and abstractify methods to suit their needs. For example, AbstractedArray overrides constructor to take an Il2Cpp.Array instead of an Il2Cpp.Object.
  3. Classes that allow creation of new instances should have a static create method that returns a new instance of the class. If the class can store data, such as AbstractedArray, it should have a static createEmpty method that returns a new instance of the class with no data.

Abstracting C# Structs

Since structs are value types, there is no need to have anything linked to an object, therefore they do not need to inherit from AbstractedObject. Instead, according to your needs you should create your own class. For example, if you want to abstract UnityEngine.Vector3, you should create a class called KeyValuePair that has the following methods:

  • public static constructor(k: Il2Cpp.Object, v: Il2Cpp.Object) - Creates a new instance of the class with the specified values.
  • public static abstractify(nativeObject: Il2Cpp.ValueType) - Same as constructor, but takes the values from the native object.
  • public deabstractify() - Creates a new C# object with the values from the abstraction. There's no need for a native property, since there's no object to link to (ValueType objects are passed by value, not by reference).

Documentation

Base AbstractedObject Class

AbstractedObject is the base class for all abstracted objects. Properties:

  • protected native - The Il2Cpp.Object that this class is abstracting.
  • public getter object - same as native but readonly and public. Methods:
  • public static constructor(native: Il2Cpp.Object) - Creates new abstraction object linked to a native object.
  • public static abtractify(native: Il2Cpp.Object) - Same as constructor