Skip to content

Suggestion Light struct :) #42

Open
@0xcds4r

Description

@0xcds4r

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;
		}
	}
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions