Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Instantiating ScriptableObjects when a client connects.

Discussion in 'Scripting' started by Avo, Aug 30, 2018.

  1. Avo

    Avo

    Joined:
    Dec 4, 2010
    Posts:
    236
    I'm working on a multiplayer game where the player controls multiple units. Each of the units has a list of scriptable objects that contain information about the ability and a method that triggers it. This works fine when the host tells a unit to trigger an ability however the moment a client tells a unit to trigger an ability I get the error message

    Construct must be instantiated using the ScriptableObject.CreateInstance method instead of new Construct.

    I never attempt to instantiate any of the scriptable object derived abilities, all of them are assigned to my units through my inspector. I've been struggling with this for a while, any help would be greatly appreciated!
     
  2. Avo

    Avo

    Joined:
    Dec 4, 2010
    Posts:
    236
    bump
     
  3. Avo

    Avo

    Joined:
    Dec 4, 2010
    Posts:
    236
    I hate to bump again but I've been really struggling to find a solution to this. I might ditch the scriptable objects entirely.
     
  4. MaskedMouse

    MaskedMouse

    Joined:
    Jul 8, 2014
    Posts:
    1,057
    Maybe it’s a bug, I don’t know enough of networking to answer that, but also you’ve posted no code.

    I wouldn’t ditch scriptable objects because they’re great for storing data. It makes it easily changeable without having to change code.

    Is there any difference in handling between client and host of triggering an ability?