Problem with js talking to c#

I am having trouble with something. I have been manipulating variables of one script from others and it has been working fine for the most part. But then I noticed the “mouselook” script is not in js. I was trying to stop it from running when I am in a certain type of control mode.

Basically. I want to be able to lock the game from using mouselook so I can move the mouse around the screen when I press a key so I can move objects without the screen moving etc… Then when I press it again it goes back to normal mode with mouselook working… I have the functionality already working… the one missing link is getting mouselook to stop when I tell it to from a js script.

I also wonder about some other things still. I am wishy-washy about understanding how “global” variables work with static. It seems that I still have to reference the script… which is fine, however that doesn’t seem very global. The other oddity is needing to call up specific object names and then get their components before you can modify their “global”/static variables.

I am starting to think I should make one “action” object like people do in the flash world, and do all of my code in that one space. That would seem a bit insane to most OOP minded people but I grew up on an Amiga so whatever lol.

My main concern and NEED at this point is getting the c# mouselook under control from other js. I tried using mouselookplus from the wiki because it is in js and would be much easier to integrate. BUT… Neither version of that worked at all. It would only work when I left in the key press functons… and then it would cause the player to lose mouse functionality when walking lol… wtf is the point of that? To simulate a person with no coordination lol.

Anyway, I have been silently watching this forum for a bit and love all of the help people provide. I searched and searched for an answer to this and can’t seem to find one in detail.

try myGameObject.GetComponent(MouseLook).enabled = false;

I Got it all working FINALLY. My internet went for an entire day and I had no way of checking things online or this forum so I ended up trying something sneaky. I figured the engine HAS to be able to call functions while running so instead of trying to pass variables into C# from js I just called functions that set variables in the c# lol. I heard that the disable thing wouldn’t work for someone else. I will try it though because it should be way less code and less to do on the fly.

Thank you for the suggestion though, I will give it a shot. Once I can get a grip on this and it all feels second nature, then I can be 100% creativity and do ANYTHING. Within the limits of the users system and the engine of course.

UPDATE!..I tried the one line of code and used it for both of the mouselook scripts and it worked. I don’t know why that other person had the issue with it. Works wonderfully! Thanks. Just took about 30 lines of code and broke it into 10.