Announcement

Collapse
No announcement yet.

NullRefere

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Maxdg
    replied
    Edited the github.

    Leave a comment:


  • starostin13
    replied
    Originally posted by JavierCanton View Post
    Hi Starostin13,

    As mrcoffee says you need to register a service before to use it, that why you receive null.

    But did you say that this an example of our github sample repository?

    Sorry for long delay. I mean this https://github.com/WaveEngine/Docume...ltiplayer-game. I think this point should be clarified.

    Meanwhile, when I update Game.cs file I get new exception that occurred when I'm try to start new client (I've attached screenshot also)
    {"Type is not expected, and no contract can be inferred: WaveEngine.Framework.Entity"}

    Have some ideas here?

    P.S.: Great thanks to mrcoffee
    Attached Files

    Leave a comment:


  • JavierCanton
    replied
    Hi Starostin13,

    As mrcoffee says you need to register a service before to use it, that why you receive null.

    But did you say that this an example of our github sample repository?


    Leave a comment:


  • mrcoffee
    replied
    The problem is in your Game.cs file

    Code:
     public override void Initialize(IApplication application)
    {
    base.Initialize(application);
    
    ScreenContext screenContext = new ScreenContext(new MyScene());    
    WaveServices.ScreenContextManager.To(screenContext);
    
    WaveServices.RegisterService(new NetworkService());
    }
    You have to register your service before calling the MyScene constructor, because you are trying to retrieve the service there.

    Code:
     public override void Initialize(IApplication application)
    {
    base.Initialize(application);
    
    WaveServices.RegisterService(new NetworkService());
    
    ScreenContext screenContext = new ScreenContext(new MyScene());    
    WaveServices.ScreenContextManager.To(screenContext);
    
    }

    Leave a comment:


  • starostin13
    started a topic NullRefere

    NullRefere

    I'm trying to build example from GitHub

    Example suggest add this line to constructor
    this.networkService = WaveServices.GetService<NetworkService>();
    But 'networkService' still null. It's generate nullreferenceeception later.

    Here is a link to archive with my project: https://yadi.sk/d/Bu3Z1qiouNB9P
Working...
X