- Home /
Tanks 3D: The tanks index does not show up in the Inspector/Game Manager script
I made sure that I was using the correct code in the CameraControl and GameManager scripts. As instructed in the tutorial, I also used the following line in the CameraControl script: [HideInInspector] public Transform[] m_Targets; However, the tanks index does not show up in the Inspector/Game Manager component. What am I doing wrong?
Answer by CBlockSurprise · Feb 26, 2019 at 06:25 AM
@yz09tech - A [HideInInspector]
hides the public variable from the inspector. If you delete it, it should show the array. Change:
[HideInInspector]
public Transform[] m_Targets;
to just this:
public Transform[] m_Targets;
(Also looking at your code and editing it)
using UnityEngine;
public class CameraControl : MonoBehaviour {
public float m_DampTime = 0.2f;
public float m_ScreenEdgeBuffer = 4f;
public float m_MinSize = 6.5f;
public Transform[] m_Targets; //This line is the tank index, and a comment.
// The next line is supposed to show the tanks index in the
That should work. You had a // in front of your array, and a // means that it is just a comment, not affecting the code
Answer by yz09tech · Feb 26, 2019 at 02:36 PM
Thank you. I changed the script as you said, but still it does not show the tanks index in the Inspector/GameManager. Taking the [HideInInspector] out works ok when used with the Inspector.CameraRig (the tanks index appear). What could be causing the problem in the Inspector/GameManager?
Would you be able to show the code? It will be easier for solving the issue.
The upper code in the CameraControl script is as follows:
using UnityEngine; public class CameraControl : $$anonymous$$onoBehaviour { public float m_DampTime = 0.2f;
public float m_ScreenEdgeBuffer = 4f; public float m_$$anonymous$$inSize = 6.5f;
// public Transform[] m_Targets; This line shows the tanks index in the Inspector/CameraRig: // The next line is supposed to show the tanks index in the Ibspector/Game$$anonymous$$anager: [HideInInspector] public Transform[] m_Targets;
….…
I tied to attach the images of the Inspector/CameraRig and Inspector/Game$$anonymous$$anager but the attachment option (paper clip) didn't work.
I was not able to attach an image to this message, so I started a new message and used chrome to attach the image. Please take a look at it.
Your answer
Follow this Question
Related Questions
Open settings dialog like Player, Quality, Render Settings via C#. 0 Answers
How can i make both two cameras to follow the player but only one with control on player ? 0 Answers
Tanks 3D: The tanks index missing in the Inspector/Game Manager script (Follow up) 2 Answers
How can I get the name of a class into a script from the editor. 1 Answer