Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion Light struct :) #42

Open
0xcds4r opened this issue Mar 30, 2025 · 0 comments
Open

Suggestion Light struct :) #42

0xcds4r opened this issue Mar 30, 2025 · 0 comments

Comments

@0xcds4r
Copy link

0xcds4r commented Mar 30, 2025

I don't recommend applying it to everyone, otherwise it will slow down xd

struct Light : Behaviour {
	int m_BakedIndex;

	static std::vector<Light*> FindAll() {
		UnityResolve::Class* lightClass = UnityResolve::Get("UnityEngine.CoreModule.dll")->Get("Light");
		if (lightClass) {
			return lightClass->FindObjectsByType<Light*>();
		}
		return {};
	}

	void SetIntensity(float value) {
		UnityResolve::Class* lightClass = UnityResolve::Get("UnityEngine.CoreModule.dll")->Get("Light");
		if (lightClass) {
			UnityResolve::Method* setIntensityMethod = lightClass->Get<UnityResolve::Method>("set_intensity", { "System.Single" });
			if (setIntensityMethod) {
				setIntensityMethod->Invoke<void>(this, value);
			}
		}
		else {
			std::cerr << "Light class not found" << std::endl;
		}
	}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant