Skip to content

Suggestion Light struct :) #42

New issue

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

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

Already on GitHub? # to your account

Open
0xcds4r opened this issue Mar 30, 2025 · 1 comment
Open

Suggestion Light struct :) #42

0xcds4r opened this issue Mar 30, 2025 · 1 comment

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;
		}
	}
};
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@0xcds4r and others