Search Unity

Prefabs generated close to other equal prefabs.

Discussion in 'Scripting' started by InsertNameH3re, Apr 18, 2021.

  1. InsertNameH3re

    InsertNameH3re

    Joined:
    Apr 18, 2021
    Posts:
    13
    Hello. I am totally new to Unity, and have searched for simple tutorials for making games. I found this one to make a tsum tsum game, but it stopped doing lessons and I don't know how to continue on my own. He stopped doing them in scripting lesson 2, and I don't know anything about scripts, at most changing values or fixing small bugs. So I want to know how to continue.
    The only thing I need now is to know how to make the pets fall together with other types (for example, that when the game starts the cats appear near other cats so that it is easier to join)
    I am on unity 5.1.2f1

    --------------------------------------------------------------------------------------------------------
    Here is the script I have:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class GamePlay : MonoBehaviour {
    5.    
    6.     public GameObject[] petList;
    7.     public int maxPetCount = 40;
    8.    
    9.     // Use this for initialization
    10.     void Start () {
    11.        
    12.         for (int i=0; i<maxPetCount; i++) {
    13.             GameObject instance = Instantiate (petList[Random.Range(0, petList.Length)], new Vector3 (Random.Range(-2.6f, 2.6f), 7.0f, -1.0f), Quaternion.identity) as GameObject;
    14.            
    15.         }
    16.     }
    17.    
    18.     // Update is called once per frame
    19.     void Update () {
    20.    
    21.     }
    22. }
    23.