Bolt Basics - Instantiating a player and assigning controls

Options
So I decided to switch to Bolt a couple days ago from UNet. I'm hoping to have smoother network sync with Bolt with some of it's out of the box solutions.

My current dilemma is, I am just working with the basics and trying to assign controls to player on load which basically just consists of enabling scripts and/or other components that control player movement/cameras/etc... According to the documentation, it seemed like this would best be done under SimulateOwner() method. However, after doing a build and testing, both players have controls over both players.

So really my question is: What is the best way to assign controls to a single player.

Comments

  • AdamN
    Options
    This is my code I am using which for the most part I got from the documentation.
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.Networking;
    
    public class AssignPlayerControl : Bolt.EntityBehaviour<IMainPlayer>
    {
        public override void Attached()
        {
            state.SetTransforms(state.MainPlayerTransform, transform);
        }
        public override void SimulateOwner()
        {
            BaseAttributes.FPCamera.enabled = true;
            BaseAttributes.MouseLook.enabled = true;
            BaseAttributes.CCDriver.enabled = true;
            BaseAttributes.PlayerInput.enabled = true;
        }
    }
    
  • stanchion
    Options
    You are enabling these things on owner when you should be enabling them on ControlGained.

    The tutorial goes step by step through making a server auth game https://doc.photonengine.com/en-us/bolt/current/advanced-tutorials/chapter-1