Hi I am making a game (of course) and i have the idea to have a system to switch characters in the main menu and play with it in the game and their 2 separate scenes. i made two separate scripts one for the Main Menu:
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class PlayerShips : MonoBehaviour {
public bool Ship1Equiped;
public bool Ship2Equiped;
public bool NoShipsEquiped;
private ActivateShips TheShips;
//public Text StopPlayer;
public Text Unequipandequipbutton;
void Start()
{
GameObject TheShipsObject = GameObject.FindWithTag("ShipManager");
if (TheShipsObject != null)
{
TheShips = TheShipsObject.GetComponent<ActivateShips>();
}
if (TheShips == null)
{
Debug.Log("Cannot find 'ActivateShips' script");
}
}
public void Ship1 ()
{
if (Ship1Equiped == true)
{
Unequipandequipbutton.text = "Unequip";
TheShips.Shipone.SetActive(true);
TheShips.Shiptwo.SetActive(false);
Debug.Log ("Ship1 Equiped");
}
}
public void Ship2()
{
if(Ship2Equiped == true)
{
Unequipandequipbutton.text = "Equip";
TheShips.Shipone.SetActive(false);
TheShips.Shiptwo.SetActive(true);
}
}
/*public void NoShips()
{
if (Ship1Equiped = Ship2Equiped == false)
{
StopFromPlayingGame();
}
}
//public void StopFromPlayingGame()
{
StopPlayer.text = "!!Please Select A Ship!!";
}*/
public void Equiped1()
{
Ship1Equiped = (true);
}
public void Equiped2()
{
Ship2Equiped = (true);
}
public void UnequipButtonShip1()
{
Ship1Equiped = (false);
}
public void UnequipButtonShip2()
{
Ship2Equiped = (false);
}
}
//I HAVE NEVER TYPED THE WORD SHIP SO MANY THIS MANY TIMES IN MY LIFE
(I know the code is noobish b__ut i’m still learning and had no other way around that i knew of)__
and other for the Game scene:
```csharp
__using UnityEngine;
using System.Collections;
public class ActivateShips : MonoBehaviour {
public GameObject Shipone;
public GameObject Shiptwo;
void Start () {
}
void Update () {
}
}__
```
then when i run it and test it it says “Cannot find ‘ActivateShips’ script” so is there any way to communicate between them if i cant use the tags
Thanks in Advance
Also is there and was to fix this
```csharp
__/*public void NoShips()
{
if (Ship1Equiped = Ship2Equiped == false)
{
StopFromPlayingGame();
}
}
//public void StopFromPlayingGame()
{
StopPlayer.text = "!!Please Select A Ship!!";
}*/__
```
and make the script shorter.