Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How do I edit this code to show the game object to show up on mouse click. and how to show the x and y

image text in transcribed

How do I edit this code to show the game object to show up on mouse click.

and how to show the x and y of the mouse

and how to use the time slider to delete the shape after set amount of seconds

and how to use the toggle to turn of the timer to keep the drawing instead of deleting after set amount of seconds

9 CA ds c UnitClick.cs using System.Collections; Untitled-1 . Users > yaseenhafeez > Sprint 1 (IT201) > Assets > Script > UnitClick.cs 1 using System.Collections; 2 using System.Collections.Generic; 3 using UnityEngine; 4 using UnityEngine.UI; 5 6 public class UnitClick : MonoBehaviour 7 8 public Slider redslider; 9 public Slider blueSlider; 10 public Slider greenslider; 11 public Slider timeslider; 12 public Dropdown shapeDropdown; 13 public GameObject particle; 14 public Toggle Timer:| 15 16 void Start() 17 { 18 19 } 20 21 void Update() 22 { 23 if (Input.GetMouseButtonDown (0)) 24 { 25 PrimitiveType shapeToSpawn = PrimitiveType.Cube; 26 if (shapeDropdown.value = 0) 27 28 shapeToSpawn = PrimitiveType.Cube; 29 } 30 else if (shapeDropdown.value = 1) 31 { 32 shapeToSpawn = PrimitiveType. Sphere; 33 } 34 else if (shapeDropdown.value 2) 35 { 36 shapeToSpawn = PrimitiveType.Capsule; 37 } 38 GameObject shape = Instantiate (GameObject.CreatePrimitive(shapeToSpawn)); 39 shape.GetComponent().material.color = new Color(redslider.value, greenslider.value, blueSlider.value); 40 41 } 42 43 44 } 45 17 0AO 46 Ln 14, Col 23 Spaces: 4 UTF-8 with BOM CRLF C# D 9 CA ds c UnitClick.cs using System.Collections; Untitled-1 . Users > yaseenhafeez > Sprint 1 (IT201) > Assets > Script > UnitClick.cs 1 using System.Collections; 2 using System.Collections.Generic; 3 using UnityEngine; 4 using UnityEngine.UI; 5 6 public class UnitClick : MonoBehaviour 7 8 public Slider redslider; 9 public Slider blueSlider; 10 public Slider greenslider; 11 public Slider timeslider; 12 public Dropdown shapeDropdown; 13 public GameObject particle; 14 public Toggle Timer:| 15 16 void Start() 17 { 18 19 } 20 21 void Update() 22 { 23 if (Input.GetMouseButtonDown (0)) 24 { 25 PrimitiveType shapeToSpawn = PrimitiveType.Cube; 26 if (shapeDropdown.value = 0) 27 28 shapeToSpawn = PrimitiveType.Cube; 29 } 30 else if (shapeDropdown.value = 1) 31 { 32 shapeToSpawn = PrimitiveType. Sphere; 33 } 34 else if (shapeDropdown.value 2) 35 { 36 shapeToSpawn = PrimitiveType.Capsule; 37 } 38 GameObject shape = Instantiate (GameObject.CreatePrimitive(shapeToSpawn)); 39 shape.GetComponent().material.color = new Color(redslider.value, greenslider.value, blueSlider.value); 40 41 } 42 43 44 } 45 17 0AO 46 Ln 14, Col 23 Spaces: 4 UTF-8 with BOM CRLF C# D

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Understanding Databases Concepts And Practice

Authors: Suzanne W Dietrich

1st Edition

1119827949, 9781119827948

More Books

Students also viewed these Databases questions

Question

When is it appropriate to use a root cause analysis

Answered: 1 week ago

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago