Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Official TANKS! Tutorial Q&A

Discussion in 'Community Learning & Teaching' started by willgoldstone, Sep 21, 2015.

  1. greatness

    greatness

    Joined:
    Feb 20, 2016
    Posts:
    199
    I have another problem. My tanks cant seem to lose health :(

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.UI;
    3.  
    4. public class TankHealth : MonoBehaviour
    5. {
    6.     public float m_StartingHealth = 100f;        
    7.     public Slider m_Slider;                      
    8.     public Image m_FillImage;                    
    9.     public Color m_FullHealthColor = Color.green;
    10.     public Color m_ZeroHealthColor = Color.red;  
    11.     public GameObject m_ExplosionPrefab;
    12.    
    13.    
    14.     private AudioSource m_ExplosionAudio;        
    15.     private ParticleSystem m_ExplosionParticles;  
    16.     private float m_CurrentHealth;
    17.     private bool m_Dead;          
    18.  
    19.  
    20.     private void Awake()
    21.     {
    22.         m_ExplosionParticles = Instantiate(m_ExplosionPrefab).GetComponent<ParticleSystem>();
    23.         m_ExplosionAudio = m_ExplosionParticles.GetComponent<AudioSource>();
    24.  
    25.         m_ExplosionParticles.gameObject.SetActive(false);
    26.     }
    27.  
    28.  
    29.     private void OnEnable()
    30.     {
    31.         m_CurrentHealth = m_StartingHealth;
    32.         m_Dead = false;
    33.  
    34.         SetHealthUI();
    35.     }
    36.  
    37.  
    38.     public void TakeDamage(float amount)
    39.     {
    40.         // Adjust the tank's current health, update the UI based on the new health and check whether or not the tank is dead.
    41.         m_CurrentHealth -= amount;
    42.         SetHealthUI();
    43.         if (m_CurrentHealth <= 0 && !m_Dead)
    44.         {
    45.             OnDeath();
    46.         }
    47.     }
    48.  
    49.  
    50.     private void SetHealthUI()
    51.     {
    52.         // Adjust the value and colour of the slider.
    53.         m_Slider.value = m_CurrentHealth;
    54.  
    55.         m_FillImage.color = Color.Lerp(m_ZeroHealthColor, m_FullHealthColor, m_CurrentHealth/m_StartingHealth);
    56.     }
    57.  
    58.  
    59.     private void OnDeath()
    60.     {
    61.         // Play the effects for the death of the tank and deactivate it.
    62.         m_Dead = true;
    63.  
    64.         m_ExplosionParticles.transform.position = transform.position;
    65.         m_ExplosionParticles.gameObject.SetActive(true);
    66.  
    67.         m_ExplosionParticles.Play();
    68.  
    69.         m_ExplosionAudio.Play();
    70.  
    71.         m_ExplosionParticles.gameObject.SetActive(false);
    72.  
    73.  
    74.     }
    75. }
     
  2. CrazyDevelopment

    CrazyDevelopment

    Joined:
    Jun 23, 2016
    Posts:
    1
    Me to.my shell cant damaged the tanktank why??
     
  3. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    Is it always true technique that keeping particle system in memory or scene. And if we need we SetActive (true), if not (false). Is it really better than destroying particle system and instantiating it again and again.
     
  4. FightingAtomStudios

    FightingAtomStudios

    Joined:
    Jun 28, 2016
    Posts:
    1
    Please Help Im doing the Tanks Tutorial and everytime I shoot the shell the camera does fp from the shell, I dont know whats wrong

    EDIT: I forget to uncomment Hide Inspector
    He... Whoops:p
     
    Last edited: Jun 28, 2016
  5. monkeybrainz

    monkeybrainz

    Joined:
    Dec 16, 2015
    Posts:
    35
    just finished the tutorial and must say the instruction was quite thorough and clear! this would be really fun over a network
     
  6. jquin

    jquin

    Joined:
    Feb 19, 2013
    Posts:
    1
    Hi im done with the tutorial, but the tanks and shells wont show, they are invisible. There no compile error and the prefab of the tank is well asigned into the GameManager.
     
  7. KAYUMIY

    KAYUMIY

    Joined:
    Nov 12, 2015
    Posts:
    115
    As far as ShellExplosion script is concerned, particle system variable was public. We did not instantiate, just drag and drop.

    On the other hand, In terms of TankHealth script, particle system was instantiated and SetActive (false).

    My question is when we have to instantiate the particle system from Prefab, and when we declare it is public (drag and drob).
     
  8. herano

    herano

    Joined:
    Aug 20, 2016
    Posts:
    4
    Hello,
    I just started with this tutorial and I have two questions.
    1. When i imported the assets I got this error:
    'Lighting data asset 'LightingData' was built with a different version of Enlighten. Realtime GI will not be used. Please rebuild lighting for this scene.
    UnityEditorInternal.InternalEditorUtility:GetGameObjectInstanceIDFromComponent(Int32)
    UnityEditor.DockArea:OnGUI()'
    What should I do about this?

    2. When I try to set the color of the ambient lighting I get a different menu that what is shown in the tutorial, with only 3 places to set the color. And when I try to put in the variables mentioned my whole scene becomes white. Why is this?

    Thanks for the help:).
     
  9. blazeminer

    blazeminer

    Joined:
    Sep 22, 2016
    Posts:
    2
    WOW HOW DID U DO THAT
     
  10. JayBigGuy10

    JayBigGuy10

    Joined:
    Sep 30, 2016
    Posts:
    1
    Hi
    I have started work on this tutorial today and I have ran into an issue.
    I am up to phase 3 "camera control" and I am trying to add a target for the camera control script
    (around 29:11) but there is no "targets" tab. Just not there
    any ideas why?

    Jayden
     
    MissHailey202 likes this.
  11. Ralon

    Ralon

    Joined:
    Oct 1, 2016
    Posts:
    1
    Hi all!
    I'm very new to unity (and scripting, and C# o_O), and excited about learning!!
    awsome tanks tutorial, enjoyed every bit of it :)

    So, i'm aiming for android game development, and for the purpose of learning i'm trying to convert tanks game into android version.
    Not full game version of course, just moving around and shoot with one tank.
    2 questions:
    1. Am i an idiot :oops:? I mean, am i going the right way, or is there any android game development guide?
    Tanks tutorial seems to have what i need for my first game (moving around, colliding into things, camera that follow the player, etc.).
    2. I've managed to add a virtual joystick to the game, and passed it to tank movement (by the gameManager and through tankManager, willing to take any suggestions about how to do it better). When i play the game with Unity remote it works perfectly, but when creating apk and installing on my device i get 'Round 1' text, background music and black screen...

    Any advice of how can fix it?

    Thanks in advance
     
  12. pritul_123

    pritul_123

    Joined:
    Nov 20, 2015
    Posts:
    1
    Can anyone help me with this tank project?

    I want to add a tank AI, so how can i add AI tank with game manager?
     
  13. VitaminK

    VitaminK

    Joined:
    Sep 30, 2016
    Posts:
    3
    This has already been answered on Page 2 of this thread.
     
  14. VitaminK

    VitaminK

    Joined:
    Sep 30, 2016
    Posts:
    3
    I'm really not sure what is wrong here but I am unable to click on or drag and drop anything from the models folder into the scene or the hierarchy. I have reloaded the assets several times to try and fix it but nothing seems to work.

    --EDIT--
    Not sure if this is a bug but changing my layout fixed the issue. If I try and make the thumbnail icons a list I am unable to select anything in models folder and drag anything out but if I have it on default settings of 2x3 and they are thumbnails it lets me....
     
  15. Jackers20

    Jackers20

    Joined:
    Nov 23, 2016
    Posts:
    1
    When I put the camera control script into the camera rig, it has no target collapsible panel.
    Part 3/8 28 minutes in
    Also the completed Assets script doesn't have that target collapse panel.
     
  16. CoachCrowell

    CoachCrowell

    Joined:
    Dec 6, 2016
    Posts:
    2
    I am having an error in my code and can't figure out why this is popping up. Any help?
     

    Attached Files:

  17. CoachCrowell

    CoachCrowell

    Joined:
    Dec 6, 2016
    Posts:
    2
    Here is the larger image

    unnamed.png
     
  18. reazonsraj

    reazonsraj

    Joined:
    Nov 10, 2016
    Posts:
    1
    well i am having this problem the script is copied from the tutorial so no problem in that but when i try to move my tank it just sutters and move like its lagging just the partical system moves i don't know what to do please help.
     

    Attached Files:

    • tank.png
      tank.png
      File size:
      247.8 KB
      Views:
      2,257
  19. DDAUDIOSOLUTIONS

    DDAUDIOSOLUTIONS

    Joined:
    Sep 5, 2015
    Posts:
    21
    Hi, i have a doubt, i would like to use an script where the sound of the explosion will be diferent, when the shell impact in the diferent elements.

    using UnityEngine;
    using System.Collections;

    publicclassExplosionSound:MonoBehaviour{

    //Usethisfor initialization
    voidStart(){

    }

    privatevoidOnCollisionEnter(Collisionhit)
    {
    if(hit.collider.CompareTag("Atrezzo")){

    FMODUnity.RuntimeManager.PlayOneShot("event:/Military_Edif/Explosions");
    }

    if(hit.collider.CompareTag("Nature"))
    {

    FMODUnity.RuntimeManager.PlayOneShot("event:/Explosions_Nature");
    }
    }



    //Updateiscalledonceper frame
    voidUpdate(){

    }
    }


    I know that the script works fine!! but, someone can help me and tell me in which gameobject i have to put the script. In "CompleteShell" in "CompleteShellExplosion"...or in other.

    i have tried in some gameobjects and not works. But i have tried in the tank, and works, when collide with the builds, or trees or whatever, play the sounds that are in the script.

    thanks
     
  20. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Hi @JayBigGuy10, for this step, in your CameraControl.cs, please make sure that in line 8, the "[HideInInspector]" in front of "public Transform[] m_Targets" is commented out, like this:
    https://www.youtube.com/watch?t=601&v=llEJtLuQyPM Please watch the youtube vid in that link, because they give a really good explanation for it.
    Code (CSharp):
    1. /*[HideInInspector]*/ public Transform[] m_Targets;
    The reason for this is that "[HideInInspector]" makes this field invisible in the inspector/editor.
     
    Last edited: Jan 4, 2017
  21. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Hi @Jackers20, for this step, in your CameraControl.cs, please make sure that in line 8, the "[HideInInspector]" in front of "public Transform[] m_Targets" is commented out, like this:
    https://www.youtube.com/watch?t=601&v=llEJtLuQyPM
    Code (CSharp):
    1. /*[HideInInspector]*/ public Transform[] m_Targets;
    The reason for this is that "[HideInInspector]" makes this field invisible in the inspector/editor. Please watch the youtube vid in that link, because they give a really good explanation for it.

    The completed version doesn't have the target collapse panel either, because "[HideInInspector]" was commented back into the code, because they didn't need it anymore since another script was adding the m_Targets instead of doing it manually in the inspector.
     
  22. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Hi @CoachCrowell, that error message means that another Class already exists in your code that has that name, so the code doesn't want that, since it doesn't know which one to use if there are 2 of them with the same name inside the same directory.

    What you could do is to rename yours to something else, like "TankShootingScript", like this:
    Code (CSharp):
    1. public class TankShootingScript : MonoBehaviour
    Please also make sure to use the Unity editor/inspector to change the name of the file also to "TankShootingScript", since the name of the Class needs to be the same as the name of the C# script.
     
  23. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Hi @reazonsraj, please check to see if the TankMovement script is attached to the tank, and not to the RightDustTrail child object.
     
  24. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    I can't believe not more people clicked "Like" for this, @RockmanZ!! ^__^ Thanks!! :D
     
  25. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    This looks really cool, @Der_Kevin!!!
     
  26. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Hi @willgoldstone, thanks for all the video tutorials. There is just something small that I want to ask about, and it's not a big deal, because I was able to complete the project even without it and it's just a cosmetic difference.

    Basically, the DustTrail particle effects only appear when the tanks are turning right or left. When they move forwards and backwards, the particle effects don't appear. I checked this too with the completed assets version, and it's the same thing (no DustTrail particles when moving forwards or backwards). I think that it's because of the version difference. But I would like to know how to solve it.

    Also, another thing, in the first video, when you were showing the Lighting - Environmental Lighting - Ambient Color setup:
    https://www.youtube.com/watch?t=373&v=paLLfWd2k5A
    (That's 06:13 - 06:16 of https://unity3d.com/learn/tutorials/projects/tanks-tutorial/scene-setup?playlist=20081)

    It looks like this now, so please add this to your original post:
    new_version_of_lighting-ambient-color.png
    Instead of just "Color", it's now "HDR Color". If you'll notice, there's no slider for Alpha. So the numbers in the video "(72, 62, 113)" won't work anymore.

    But you'll still be able to get the same color results by 2 ways:
    1. Use the same Hex color of "483E71". OR
    2. Divide each number in "(72, 62, 113)" by 255. So in this case:
      • Red = 72 / 255 = 0.2823529411764706
      • Green = 62 / 255 = 0.2431372549019608
      • Blue = 113 / 255 = 0.4431372549019608
    If you'll add that to either the annotations of the tutorial video or to your original post, I think this would help a lot of people.

    Thanks in advance for answering both of my questions! ^_^
     
    Last edited: Jan 5, 2017
  27. Cleite

    Cleite

    Joined:
    Dec 17, 2016
    Posts:
    4
    In the TankMovement script, shouldn't you use Time.fixedDeltaTime rather than Time.deltaTime in Move() and Turn()? What consequences do you get for picking the wrong one?

    And what do you get from using a rigidbody on the tanks? Couldn't you manipulate the transform directly? Or do you have to have a rigidpody for the collision with buildings and rocks to work?
     
    Last edited: Jan 12, 2017
  28. TwiiK

    TwiiK

    Joined:
    Oct 23, 2007
    Posts:
    1,729
    Time.deltaTime is never wrong. :) Ref. https://docs.unity3d.com/ScriptReference/Time-deltaTime.html

    The relevant part:
    "When called from inside MonoBehaviour's FixedUpdate, returns the fixed framerate delta time."

    You should find the answers to this question here:
    https://docs.unity3d.com/Manual/CollidersOverview.html

    Look at the part under "Collider interactions". Summarized: A collider without a rigidbody is considered a static collider and should never move. Any collider that moves should have a rigidbody attached to it.

    I think there's a massive performance hit when moving a collider without a rigidbody or it may not even work at all, I haven't tested it myself.
     
  29. Cleite

    Cleite

    Joined:
    Dec 17, 2016
    Posts:
    4
    Right, the static thingy. Yes, now that you mention it, I think I heard something about Unity baking all non-rigidbody-colliders whenever one of them changes. I think the Roll-A-Ball tutorial mentioned it.
     
  30. Pocketknife316

    Pocketknife316

    Joined:
    Sep 21, 2016
    Posts:
    6
    Hi, I just finished "Firing Shells" and I have a problem.

    1: When I hold spacebar, the slider does not appear and won't fire automatically when it reaches the longest point.

    2: The shell fires but it makes no difference how long I hold spacebar.

    3: The explosion particle effect won't happen when the shell hits anything.

    Help!
     
  31. jgambuto

    jgambuto

    Joined:
    Jan 24, 2017
    Posts:
    1
    Bless you!!!!! I knew something was off due to being built on a newer version(and everything being washed out of course) but continued on with the tutorial till I could check if there was an update.

    Thanks! =)
     
    BerniceChua likes this.
  32. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    You're welcome! ^_^

    Yeah, I knew it would be different because the new version of the color picker didn't have a slider for the Alpha value, and I got the same washed out color.

    I found some documentation about it here: https://docs.unity3d.com/Manual/HDRColorPicker.html
     
  33. DDAUDIOSOLUTIONS

    DDAUDIOSOLUTIONS

    Joined:
    Sep 5, 2015
    Posts:
    21
    Hi everyone,

    I want to complicate a little the sound of the Tanks, and i would like to use a different engine sound for each tank.

    The two tanks of the game, are create from the same prefab, but the TankMovement has:
    public int m_PlayerNumber=1; //Usedtoidentifywhichtankbelongstowhichplayer.Thisissetbythistank'smanager.

    This assign a number for each player, and this is then use for the axes to know how player use keys and arrows to move the tank.

    I would like to know how could i create a relation between the player number and the sound to make that every tank has a different engine sound.

    i have this:

    private void Motor_1 ()
    {

    motor1 = FMODUnity.RuntimeManager.CreateInstance ("event:/Tank/Tank_Engine");
    motor1.set3DAttributes (FMODUnity.RuntimeUtils.To3DAttributes (gameObject));
    motor1.setParameterValue ("motorRPM", 0f);
    motor1.start ();

    }

    and other for Motor_2.

    And i think that thing is use "Motor_1();" inside some part of the script with the relation player number. but i don't know how to do it.

    Some Help?

    thanks
     
  34. h4le5torm

    h4le5torm

    Joined:
    Jan 20, 2017
    Posts:
    1
    Hello! I am new to Unity (and C#), and have just finished the TANKS! tutorial. However, I would like to add the text from the MessageCanvas displaying the words "TANKS!" before starting the game, just as it does in the Game view window. What I mean is, before it starts with "Round 1", I just want to display TANKS! for a couple seconds to introduce the game. What is the best way to go about that? Thanks in advance.
     
  35. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Hi @h4le5torm, I don't know if this is the best way, but how I would have done it is:
    Step 1: Put "TANKS!" on a canvas.
    Step 2: There are 3 ways to do this, and they all involve changing the state of that canvas object from active into inactive (http://answers.unity3d.com/questions/794362/how-to-enable-and-disable-a-canvas-window-by-scrip.html):
    2a: When the user clicks anywhere on the screen or presses a key from the keyboard like Esc, it changes the state of that canvas object from active into inactive. Or...
    2b: Use the Animation to fade the words or change the state of that canvas GameObject from active to inactive. Or...
    2c: Write a script with "WaitForSeconds(time)" to change the state of that canvas object from active to inactive (https://docs.unity3d.com/ScriptReference/WaitForSeconds.html)

    Hope that helps! ^_^
     
  36. LukaszMatysiak

    LukaszMatysiak

    Joined:
    Jan 14, 2017
    Posts:
    1
    So I tried to reproduce Dust Trail effect from this tutorial, and it turns out particle system has undergo change which made this part of tutorial obsolete: http://answers.unity3d.com/questions/1291371/unity-550-particle-system-emission-module-rate-ove.html

    In order for emision over distance to work I need to use AddForce instead of MovePosition.

    I would suggest to add some comments about it here https://unity3d.com/learn/tutorials/projects/tanks-tutorial/tank-creation-control and annotations drectly in video.
     
    quaintgames18 and BerniceChua like this.
  37. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Thank you, @LukaszMatysiak!! I was trying to figure that out in my old post!!! ^__^

    I'll try your suggestion for the dust trails.
     
  38. Beatris321

    Beatris321

    Joined:
    Feb 6, 2017
    Posts:
    1
    I almost had finished making the tanks move around when I got this error:
    MissingComponentException: There is no 'Rigidbody' attached to the "Tank" game object, but a script is trying to access it.
    You probably need to add a Rigidbody to the game object "Tank". Or your script needs to check if the component is attached before using it.
    UnityEngine.Rigidbody.get_position () (at C:/buildslave/unity/build/artifacts/generated/common/modules/Physics/DynamicsBindings.gen.cs:1463)
    TankMovement.Move () (at Assets/Scripts/Tank/TankMovement.cs:109)
    TankMovement.FixedUpdate () (at Assets/Scripts/Tank/TankMovement.cs:98)
     
  39. difficultnerd

    difficultnerd

    Joined:
    May 3, 2014
    Posts:
    52
    Just doing the Tanks! Tutorial and I've found this:

    In phase 7 of 8, GameManager.cs has us uncommenting lines 66-74, only in the package, the code is different and it's throwing an error:

    The code as written in the package is:

    private IEnumerator GameLoop()
    {
    yield return StartCoroutine(RoundStarting());
    yield return StartCoroutine(RoundPlaying());
    yield return StartCoroutine(RoundEnding());

    if (m_GameWinner != null)
    {
    SceneManager.LoadScene(0);
    }
    else
    {
    StartCoroutine(GameLoop());
    }
    }

    And the error in the console is: Assets/Scripts/Managers/GameManager.cs(69,13): error CS0103: The name `SceneManager' does not exist in the current context
     
  40. difficultnerd

    difficultnerd

    Joined:
    May 3, 2014
    Posts:
    52
    We also receive a warning for the ShellExplosion script - Assets/Scripts/Shell/ShellExplosion.cs(49,72): warning CS0618: `UnityEngine.ParticleSystem.duration' is obsolete: `duration property is deprecated. Use main.duration instead.'

    The code looks like this:
    private void OnTriggerEnter(Collider other)
    {
    // Find all the tanks in an area around the shell and damage them.

    Collider[] colliders = Physics.OverlapSphere (transform.position, m_ExplosionRadius, m_TankMask);

    for (int i = 0; i < colliders.Length; i++) {

    Rigidbody targetRigidBody = colliders.GetComponent<Rigidbody>();

    if (!targetRigidBody)
    continue;

    targetRigidBody.AddExplosionForce (m_ExplosionForce, transform.position, m_ExplosionRadius);

    TankHealth targetHealth = targetRigidBody.GetComponent<TankHealth>();

    if (!targetHealth)
    continue;

    float damage = CalculateDamage (targetRigidBody.position);

    targetHealth.TakeDamage(damage);
    }

    m_ExplosionParticles.transform.parent = null;
    m_ExplosionParticles.Play ();
    m_ExplosionAudio.Play ();

    Destroy (m_ExplosionParticles.gameObject, m_ExplosionParticles.duration);
    Destroy (gameObject);
    }
     
  41. Dawbzz

    Dawbzz

    Joined:
    Jan 26, 2017
    Posts:
    3
    Im having trouble with the camera controller.
    It follows the tank but the tank is outside the cameras view so i cant see where its going
     
  42. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Could you check if you put
    Code (CSharp):
    1. using UnityEngine.SceneManagement;
    at the very top?
     
  43. babar_ec

    babar_ec

    Joined:
    Dec 9, 2016
    Posts:
    2
    I have problem in tutorial 1. i select ambient source to color and when choosing ambient color its a hdr color and the values i set select a wrong color also there is brightness options. Please help
     
  44. AllendDerek

    AllendDerek

    Joined:
    Mar 8, 2017
    Posts:
    1
    I am having problems with my m_Explosion Prefab, i have it attached and it's still giving me a compiler error. How do i fix this.
     
  45. ignatirabo

    ignatirabo

    Joined:
    Mar 10, 2017
    Posts:
    1
  46. difficultnerd

    difficultnerd

    Joined:
    May 3, 2014
    Posts:
    52
    Hey Everyone,
    I'm intermittently getting some weird particle errors that I can't work out -

    Invalid AABB aabb
    Converting invalid MinMaxAABB
    Assertion failed on expression: 'IsFinite(d)'
    Assertion failed on expression: 'IsFinite(outDistanceForSort)'
    Assertion failed on expression: 'IsFinite(outDistanceAlongView)'​

    My Unity is up-to-date ( 5.5.1f1) so I wouldn't have thought that bug was still an issue. I note some other people on this thread run into the same thing.

    Further testing indicates it only happens if I'm pressing controls when the controls activate. Which implies it has something to do with "StartCoroutine(RoundPlaying)" in GameManager.cs (probably EnableTankControl())

    If I wait for control to be enabled before driving, the errors don't show up.

    Any ideas?

    I'd love to understand what I'm dealing with :)
     
  47. Alexbeav

    Alexbeav

    Joined:
    Jan 15, 2017
    Posts:
    15
    Hello, I have a question: how can I script the Tanks table under GameManager to accept the size value from an outside source?

    I'd like to create SpawnPoints 3 and 4, and from the main menu (which I have created) select if it's going to be a 2, 3 or 4 player game. So basically once the player number is selected and the game is launched, the proper number of tanks are spawned.

    I've set up the inputs (so Horizontal3, Horizontal4 etc.), and if I plug the numbers manually, I can get 4 players to spawn and play but I don't know how to script the number of players without using the editor.

    Further down the line I'd like to be able to select the colors from a GUI which are then applied in the Player Color fields, but that's very low priority.

    Any assistance or pointers would be greatly appreciated!
     
  48. Owen0830

    Owen0830

    Joined:
    Mar 12, 2017
    Posts:
    1
    Quick Question! In the tutorial one we have to change the Ambient colour from the lighting. While I notice that the tutors were using ordinary colour picker while my unity gives me a HDR colour picker. Any idea how to switch to a ordinary colour picker? Or is there a way to convert the value into a HDR colour picker? Really new to the Unity so just trying to follow exactly every steps...
    Thanks!
     
  49. BerniceChua

    BerniceChua

    Joined:
    Nov 30, 2016
    Posts:
    32
    Hi @babar_ec & @Owen0830, please look at this: https://forum.unity3d.com/threads/tanks-tutorial-q-a.356440/page-3#post-2908291
     
  50. Tilter

    Tilter

    Joined:
    Jun 15, 2016
    Posts:
    1
    Does someone know why does the instance of tank for player 2 only, and this is 100% of the time, drift when getting hit or bumping into objects while player 1 never does and behaves as expected. I went through all the code and i couldnt see anything that could affect them so differently. Player 1 is still bouced back when hit by a blast from a shell just doesnt continue allmost indifinetely like player 2.