title: Initializing static variables in ue4 c++
body: <p>I have a actor class <code>ANodeBase</code>. Each node must have a unique <code>id</code>. To realize that, i create static variable <code>id_counter</code>.</p>
  <p>Code:</p>
  <pre><code>//ANodeBase.h
  static int id_counter;
  //ANodeBase.cpp
  #include &quot;NodeBase.h&quot;
  
  int ANodeBase::id_counter = 0;
  
  ANodeBase::ANodeBase()
  {
      PrimaryActorTick.bCanEverTick = false;
      id = id_counter;
      id_counter++;//the only change to a variable in the project
  }
  </code></pre>
  <p>Problem is that <code>id_counter</code> wasn't initialized, more precisely, it is initialized by 13, even if I restart ue4, even when I add some code and recompile project. When I create other actors, they increase be 1.</p>
  <p>If it important, object directly created in the engine is <code>BP_NodePC : NodePC : NodeBase : Actor</code></p>
  <p>Can someone explain why does it happen or suggest an alternative count.</p>
  <p><strong>EDIT:</strong> For some unknown reason, unreal create 12 objects before launch. Don't know how fix that and why it happening</p>