- Home /
Tanks 3D: The tanks index missing in the Inspector/Game Manager script (Follow up)
using UnityEngine;
public class CameraControl : MonoBehaviour {
public float m_DampTime = 0.2f;
public float m_ScreenEdgeBuffer = 4f;
public float m_MinSize = 6.5f;
/*
This line shows the tanks index in the Inspector/CameraRig:
public Transform[] m_Targets;
*/
/* This line is supposed to show the tanks index in the
Inspector/GameManager but it does not: */
[HideInInspector] public Transform[] m_Targets;
--------------------
![alt text][1]
[1]: /storage/temp/133834-tanks.png
Answer by CBlockSurprise · Feb 27, 2019 at 01:43 AM
@yz09tech - Based off of guesses you want to have it so you could add stuff to the array Targets. In order to do that, you have to add to the size of the Targets - make it a 1 or greater (or how many targets there are). If you want the Tank Prefab variable, you have to have a public GameObject tankPrefab; in your code. But from the type of game, it adds targets to it. The [HideInInspector] was to have it not edited and maybe later in the tutorial it creates a void to edit the targets array to add targets to it. If you have to edit the targets array or anything else that is missing, please link your code, the tutorial's code, and the tutorial itself.
Answer by yz09tech · Feb 27, 2019 at 03:20 AM
I appreciate your response.
My problem was that the tanks index did not appear in the Inspector/GameManager and I was unable to do anything after that.
I finally decided to repeat all the steps in the Game Managers tutorial and, after I used the “[HideInInspector] public Transform[] m_Targets;” code in the CameraControl script, it worked! I got the tanks index in the Inspector/GameManager.
I think that the original reason for my problem was that, after I created the GamaManager module, I made changes to the CameraControl script several times and this affected the tanks index.
Your answer
Follow this Question
Related Questions
Tanks 3D: The tanks index does not show up in the Inspector/Game Manager script 2 Answers
Issue with object not bouncing around screen correctly 1 Answer
Why on the mobile do the elements seem to have a very unstable position? 0 Answers
I don't understand Vector2 + Vector3 3 Answers
Unity UI 4.6 Canvas Enable/Disable make Accessible 2 Answers