test cube

This commit is contained in:
esteb
2023-01-10 14:56:01 +01:00
parent 12d7ccfc1e
commit 1d317851f3
7 changed files with 669 additions and 19 deletions

View 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)
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dba017a8cfe6b534ba0770210b9eb4e1
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: