test cube
This commit is contained in:
31
Assets/Scripts/interfaceScript.cs
Normal file
31
Assets/Scripts/interfaceScript.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class interfaceScript : MonoBehaviour
|
||||
{
|
||||
string Btn;
|
||||
RaycastHit hit;
|
||||
public GameObject cube;
|
||||
private Renderer cubeRenderer;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
cubeRenderer = cube.GetComponent<Renderer>();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if(Input.touchCount > 0 && Input.touches[0].phase == TouchPhase.Began ){
|
||||
Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
|
||||
if(Physics.Raycast(ray, out hit)){
|
||||
btnName = hit.transform.name;
|
||||
switch (btnName){
|
||||
case "Cube":
|
||||
cubeRenderer.material.SetColor("_Color", Color.red)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/interfaceScript.cs.meta
Normal file
11
Assets/Scripts/interfaceScript.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dba017a8cfe6b534ba0770210b9eb4e1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user