当前位置:网站首页>Unity controls the selection of the previous and next characters
Unity controls the selection of the previous and next characters
2022-07-04 02:27:00 【LiPing122335】

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class tto : MonoBehaviour {
public Transform pos;//cube The location of cube Change to empty object
public GameObject[] characterPrefabArray;// Different colors of cube
public int index = 0;// See
private GameObject[] goArray;
// Start is called before the first frame update
void Start()
{
if (characterPrefabArray.Length != 0)
{
// example hide
goArray = new GameObject[characterPrefabArray.Length];
for (int i = 0; i < characterPrefabArray.Length; i++)
{
goArray[i] = Instantiate(characterPrefabArray[i], pos.position, Quaternion .identity );
goArray[i].SetActive(false);
goArray[i].transform.parent = transform;
}
goArray[0].SetActive(true);
}
}
public void PreCharacter()
{
goArray[index].SetActive(false);
index = index == 0 ? (characterPrefabArray.Length - 1) : --index;
goArray[index].SetActive(true);
}
public void NextCharacter()
{
goArray[index].SetActive(false);
index = index == characterPrefabArray.Length - 1 ? 0 : ++index;
goArray[index].SetActive(true);
}
}
边栏推荐
- Applet graduation design is based on wechat course appointment registration. Applet graduation design opening report function reference
- 15. System limitations and options
- LV1 Roche limit
- It's corrected. There's one missing < /script >, why doesn't the following template come out?
- Mysql to PostgreSQL real-time data synchronization practice sharing
- MySQL advanced (Advanced) SQL statement (I)
- Redis transaction
- Global and Chinese market of contour projectors 2022-2028: Research Report on technology, participants, trends, market size and share
- Global and Chinese markets of advanced X-ray inspection system (Axi) in PCB 2022-2028: Research Report on technology, participants, trends, market size and share
- Global and Chinese markets for electroencephalogram (EEG) devices 2022-2028: Research Report on technology, participants, trends, market size and share
猜你喜欢

IPv6 experiment

Problems and solutions of several concurrent scenarios of redis

Gee import SHP data - crop image

Solve the problem that the tabbar navigation at the bottom of vantui does not correspond to the page (window.loading.hash)

The automatic control system of pump station has powerful functions and diverse application scenarios

在尋求人類智能AI的過程中,Meta將賭注押向了自監督學習

Advanced learning of MySQL -- Application -- index

How to subcontract uniapp and applet, detailed steps (illustration) # yyds dry goods inventory #

Iclr2022 | ontoprotein: protein pre training integrated with gene ontology knowledge
![Jerry's watch listens to the message notification of the target third-party software and pushes the message to the device [article]](/img/8b/ff062f34d36e1caa9909c8ab431daf.jpg)
Jerry's watch listens to the message notification of the target third-party software and pushes the message to the device [article]
随机推荐
The "message withdrawal" of a push message push, one click traceless message withdrawal makes the operation no longer difficult
Node write API
Problems and solutions of several concurrent scenarios of redis
How to subcontract uniapp and applet, detailed steps (illustration) # yyds dry goods inventory #
3D game modeling is in full swing. Are you still confused about the future?
The boss said: whoever wants to use double to define the amount of goods, just pack up and go
String & memory function (detailed explanation)
SQL statement
MySQL advanced SQL statement (1)
The requests module uses
Measurement fitting based on Halcon learning [4] measure_ arc. Hdev routine
Hunan University | robust Multi-Agent Reinforcement Learning in noisy environment
Life cycle of instance variables, static variables and local variables
The difference between lambda expressions and anonymous inner classes
Hamburg University of Technology (tuhh) | intelligent problem solving as integrated hierarchical reinforcement learning
IPv6 experiment
What are the main investment products of bond funds and what are they
What is the intelligent monitoring system of sewage lifting pump station and does it play a big role
C language black Technology: Archimedes spiral! Novel, interesting, advanced~
Reading notes - learn to write: what is writing?