- Home /
Public variables are not showing in the inspector
In the code below, I created a state machine with a few states. I am trying to expose these to assign it in the inspector, but when unity compiles they are not available as an assignable slot?
The funny thing is, I've made other variables to test if they compile in unity, AND THEY DO! What are some of the causes of public entities not showing in the editor? using Dodgeball_StatePattern; public class Dodgeball : MonoBehaviour { // State Machine & States public StateMachine stateMachine; public IdleState idleState; public ActiveState activeState; public float test = 7; public Transform transformTest;
Answer by logicandchaos · Feb 22, 2020 at 03:02 AM
For your own classes you might have to add [System.Serializable] right before you declare the class.
Your answer
Follow this Question
Related Questions
Can't Get Public Variable in Code to Update from Inspector 2 Answers
Why does Unity3D encourage use of public variables instead of setters/getters? 1 Answer
Inspector doesn't show the public...please, help:) 1 Answer
C# | public variables in parent class should not show up in child class 1 Answer
Can you make changes to exposed public variables persist in inspector ? 1 Answer