Well, I got 3 separate scripts in C#, that need to stay each other to work correctly. These are for a functionally door system. I based my scripts on ThunderWire’s ones(His scripts are on JS). I re-write all 3 scripts from JS to C#(This is the first time that I do that), and it give me tons of errors.
I solved almost all, but there’s one more that I can’t solve, and if change something on that lines, all scripts just screw up…
This is the script(The main script, DoorController, there’s 2 more scripts, but this is the problem one)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class DoorControllerC : MonoBehaviour
{
public bool Pressed = false;
public bool isOpen = false;
public GUICrosshairC Reticle;
public bool isLocked = false;
public bool isJammed = false;
public Animation DoorOpenAnimation;
public Animation DoorCloseAnimation;
public class DoorTextClass
{
public Text DoorLockedText;
public Text DoorJammedText;
}
public DoorTexts DoorTextClase = new DoorTextClass();
//Door Sounds
public class DoorSoundsClass
{
public bool PlayDoorSound;
public AudioClip DoorOpenSound;
public AudioClip DoorCloseSound;
public bool LockedJammedSound;
public AudioClip DoorLock;
public AudioClip DoorJammed;
}
public DoorSounds DoorSoundsClase = new DoorSoundsClass();
//When the door is Open
public void Open()
{
Pressed = true;
if(DoorSounds.LockedJammedSound == true)
{
if(isLocked)
{
GetComponent.AudioSource(clip = DoorSounds.DoorLocked);
GetComponent.AudioSource(Play);
DoorLockedText();
}
if(isJammed)
{
GetComponent.AudioSource(clip = DoorSounds.DoorJammed);
GetComponent.AudioSource(Play);
DoorJammedText();
}
}
if(isOpen == false && isLocked == false && isJammed == false)
{
GetComponent.Animation(Play(DoorOpenAnimation));
if(DoorSounds.PlayDoorSound)
{
GetComponent.AudioSource(clip = DoorSounds.DoorOpenSound);
GetComponent.AudioSource(Play);
}
isOpen = true;
}
}
public void Close()
{
Pressed = true;
if(DoorSounds.LockedJammedSound == true)
{
if(isLocked)
{
GetComponent.AudioSource(clip = DoorSounds.DoorLocked);
GetComponent.AudioSource(Play);
DoorLockedText();
}
if(isJammed)
{
GetComponent.AudioSource(clip = DoorSounds.DoorJammed);
GetComponent.AudioSource(Play);
DoorJammedText();
}
}
if(isOpen == true && isLocked == false && isJammed == false)
{
GetComponent.Animation(Play(DoorCloseAnimation));
if(DoorSounds.PlayDoorSound)
{
GetComponent.AudioSource(clip = DoorSounds.DoorCloseSound);
GetComponent.AudioSource(Play);
}
isOpen = false;
}
}
public void WaitPressed()
{
if(Pressed == true)
{
yield WaitForSeconds = 2;
Pressed = false;
}
}
}
The problem is on the lines 39,12 and 26,9. It says ‘‘The type or namespace name ‘‘DoorTexts’’ could not be found, are you missing an assembly reference?..’’ and ‘‘The type or namespace name ‘‘DoorSounds’’ could not be found, are you missing an assembly reference?..’’
If I change something, then the console in-editor give me 47 errors.
Visual Studio editor doesn’t give me any error, just the unity console in-editor.