yukieiji / UnityExplorer

An in-game UI for exploring, debugging and modifying IL2CPP and Mono Unity games.
GNU General Public License v3.0
245 stars 16 forks source link

[Other]: How come UE can do this right, yet I can't? #33

Closed StupidRepo closed 1 week ago

StupidRepo commented 1 week ago

Describe the issue

I'm tryna write a BepInEx plugin for a game that adds a MonoBehaviour called Buff to a BuffManager component (using it's applicable BuffManager.AddBuff(Buff buff, float time)) however I keep failing to instantiate the different types of buffs (e.g. FireBuff) programmatically...

Yet, when I object search UnityObject of type Buff, then click on FireBuff, click Copy to Clipboard, find the BuffManager component, evaluate AddBuff and paste in the copied component... it works perfectly!

So how the hell is UE doing this, instantiating the component properly, then adding it properly? What's wrong with my code :((((

I have looked through the code and found a RuntimeHelper but I don't know where that's being referenced from :<

EDIT: It seems to be instantiating a GameObject from somewhere with the actual Buff icon and everything set in the component's gameObject??? How tf? What prefab thing is it pulling that from!?!?

yukieiji commented 1 week ago

This is a UE repository, not a place to ask about BepInEx programming skills and techniques. Please ask in the BepInEx discord or Discussion in the repository

StupidRepo commented 1 week ago

Sorry. Just figured that since I was looking through the code of UE, and pointed out the RuntimeHelper and such, that I thought maybe I could also get some help here. Thanks anyway though :)