Skip to content
MPGHThe Dark Arts
/
RegisterLog in
Forum
Community
What's NewLatest posts across the boardTrendingHottest threads right nowSubscribedThreads you follow
Discussion
GeneralIntroductionsEntertainmentDebate FortFlaming & Rage
Board
News & AnnouncementsMPGH TimesSuggestions & HelpGiveaways
More Sections
Art & Graphic DesignProgrammingHackingCryptocurrency
Hacks & Cheats
Games
ValorantCS2 / CS:GOCall of Duty / WarzoneFortniteApex LegendsEscape From Tarkov
+14 moreLeague of LegendsGTA VMinecraftRustROTMGBattlefieldTroveBattleOnCombat ArmsCrossFireBlackshotRuneScapeDayZDead by Daylight
Resources
Game Hacking TutorialsReverse EngineeringGeneral Game HackingAnti-CheatConsole Game Hacking
Tools
Game Hacking ToolsTrainers & CheatsHack/Release NewsNew
Submit a release →Share your cheat, tool, or config with the community.
AINEW
AI Tools
General & DiscussionPrompt EngineeringLLM JailbreaksHotAI Agents & AutomationLocal / Open Models
AI × Gaming
AI Aimbots & VisionML Anti-CheatGame Bots & Automation
Create
AI Coding / Vibe CodingAI Art & MediaAI Voice & TTS
The AI frontier →Where game hacking meets modern machine learning. Jump in.
Marketplace
Buy & Sell
SellingBuyingTradingUser Services
Trust & Safety
Middleman LoungeMarketplace TalkVouch Copy Profiles
Money
Cryptocurrency TalkCurrency ExchangeWork & Job Offers
Start selling →List accounts, services, and goods. Use the middleman to trade safe.
MPGH The Dark Arts

A community for offensive security research, reverse engineering, and AI.

Community

ForumMarketplaceSearch

Account

RegisterLog in

Legal

Privacy PolicyForum RulesHelp & FAQ
© 2026 MPGH · All rights reserved.Built by the community, for the community. For educational purposes onlyContent is shared for security research and education — we don't condone illegal use. You're responsible for complying with applicable laws. Use at your own risk.
Home › Forum › Programming › C# Programming › Unity and Light with C# ... [HELP]

QuestionUnity and Light with C# ... [HELP]

Posts 1–5 of 5 · Page 1 of 1
general656
general656
Unity and Light with C# ... [HELP][Solved !]
I tryed the same code (After I converted it to Java) to Java Code and it worked normally ... but after I used C# to do the same work it didn't worked I used this code for Java :
Code:
function Update () {
	
	if(Input.GetKeyDown(KeyCode.F)){
		if(light.enabled == true)
			light.enabled = false;
		else
			light.enabled = true;
			}
			}
And this for C# which didn't worked :
Code:
void Update () {
		if(Input.GetKey(KeyCode.F)){
			if(light.enabled = true){
				light.enabled = false;
			}
			else{
				Light.enabled = true;
			}
		}
	}
If you can help guys help ... Ah ... also I am a new member and I welcome myself to this beautiful forum
-------------
This Topic Has Been Solved ... thank you guys for help
#1 · edited 13y ago · 13y ago
AT
atom0s
if(light.enabled = true){

You missed a =, it needs to be == for comparing.

Also you can simplify the code to:
Code:
    void Update()
    {
        if (Input.GetKey(KeyCode.F))
        {
            light.enabled = !light.enabled;
        }
    }
#2 · edited 13y ago · 13y ago
general656
general656
You are right ... I forgot about the boolean logic ... but I repaired it and it keep sending me an error ... The Code I have now :
Code:
using UnityEngine;
using System.Collections;

public class flashing : MonoBehaviour {
	// Update is called once per frame
	void Update () {
		if(Input.GetKey(KeyCode.F)){
			if(light.enabled == true){
				light.enabled = false;
			}
			else{
				Light.enabled = true;
			}
		}
	}
	
}
And the error :


Edit :
I Did it ! Thank you dude you helped ... I thanked you
Capture.PNG
#3 · edited 13y ago · 13y ago
CE
Cernunnos
The method is
Code:
Input.GetKey
or
Code:
 Input.GetKeyDown
?
#4 · 13y ago
general656
general656
I am sorry ... the method is GetKeyDown ... isn't the same thing as an idea ? I mean generaly both of them doing the same thing except one little ... that GetKey is able to use the next code after it if only you stop holding the key ...
#5 · 13y ago
Posts 1–5 of 5 · Page 1 of 1

Post a Reply

Similar Threads

  • Public server and client, need some help with the server please.By Botmaker in Realm of the Mad God Private Servers
    138Last post 13y ago
  • Easy and extremely fast leveling (10--60) (55-56 in 15 minutes with no help)By Helper in Diablo 3 Hacks / Bots
    5Last post 14y ago
  • need a stocker and someone who can help me with my youtube videos for my *thing*By gogogokitty in DayZ Selling / Trading / Buying
    3Last post 13y ago
  • Superjump and Superman Codes??Somebody help me with these codes??By jokuvaan11 in WarRock - International Hacks
    3Last post 19y ago
  • Need help with ca---- Help me and i will gift u a gp case!By mundi006 in Combat Arms Hacks & Cheats
    10Last post 17y ago

Tags for this Thread

#csharp#java#light#lightenable#problem#unity