I found all I can find ,but I still no answer.pls help me.
Spawn a Mozzy at position?
void SpawnObject(string obj, Vector3 das, bool dyn=false)
{
NetworkInstantiateConfig prefabES = null;
foreach (NetworkInstantiateConfig prefabs in Resources.FindObjectsOfTypeAll<NetworkInstantiateConfig>())
{
if (prefabs.name.ToString() == obj)
prefabES = prefabs;
}
GameObject Obj = Singleton<HNetworkManager>.Instance.NetInstantiate(prefabES, das, Quaternion.identity, GameManager.GetSceneTime());
if (dyn==true)
{
Rigidbody rigit = Obj.GetComponent<Rigidbody>();
rigit.ResetCenterOfMass();
rigit.constraints = RigidbodyConstraints.FreezeAll;
timer.Once(4.5f, () =>
{
rigit.ResetCenterOfMass();
rigit.constraints = RigidbodyConstraints.None;
});
}
if(Obj == null)
{
Server.Broadcast("error");
return;
}
}Mozzy string = MozzyTownChassisSpawner
It has not been verified whether it works