so… I have a spaceship… and I just figured out how to have a button on screen that with a mouseclick will launch a “missile” or a “lander” gameobject… from a big, city sized first rate Spaceship… with a small flotilla of “pilot ships” around it. during a war…
Well, I’ve got a button on screen, and I’ve placed some sliders on the same canvas panal… and I THINK it’s the only Canvas to have raycasting on…
I didn’t see any tutorials on that or any recent answers on a goggle search, so I thought i’d ask here…
Frankly, looking at the Documentation on Sliders was a little overwhelming to me… (despite 2 years of using Unity… with a lot of help from this forum)… I really didn’t understand the terms or where to start.
now… what I think I need to do is… I have a script that runs my spaceships engines… right now it’s keyed to the W key for forward thrust… but what I need to do is add the code to my engine script to point to the slider thing… it came to me how to do it in the middle of the night…
so, right now these “launch missile” and “UpSlider” are in the “main menu” script, casue I’m just learning… but, I’ll (I’ll remember to add the “using UnityEngine.UI;” stuff at the top of the engine script… (and “missiles” will go on another script, one that lives on the “missile launcher”
I’m no coder, but I’m learning, and I really appreciate all the advice I get here
public void SubmitSliderSetting()
{
//Displays the value of the slider in the console.
Debug.Log(UpSlider.value);
}
public void INFO()
{
SceneManager.LoadScene("Story00");
}
public void NewGame()
{
SceneManager.LoadScene(newGameScene);
}
public void PlayWarp()
{
//SceneManager.LoadScene("theWarp");
SceneManager.LoadScene("RandomStateofGalaxy");
// additive scene loading... so brings Galaxy Map into the world
//SceneManager.LoadScene("044GalaxyMap", LoadSceneMode.Additive);
}
public void MISSILE()
{
Instantiate(GameMissile, transform.position + (transform.forward * distanceFromPlayer), Quaternion.identity);
NMissiles = NMissiles - 1;
}
here we go with a link, just a “proof of concept” and a step towards making my “dream game”