如何将UI Canvas定位在与其父游戏对象相同的位置

时间:2017-10-26 10:10:39

标签: unity3d

我制作了一个UI Canvas预制件,它有一个空的游戏对象,并附有以下脚本:

AclSecuredNamedPipeBinding binding = new AclSecuredNamedPipeBinding();
SecurityIdentifier allowedGroup = (SecurityIdentifier)(new 
NTAccount("NPServiceUsers").Translate(typeof(SecurityIdentifier)));
binding.AddUserOrGroup(allowedGroup);
studentServiceHost = new ServiceHost(typeof(StudentService.StudentService));
Uri httpBaseAddress = new 
Uri("net.pipe://localhost/ServiceHost/ServiceHost");

studentServiceHost.AddServiceEndpoint(
typeof(StudentService.IStudentService),binding, httpBaseAddress); 
studentServiceHost.Open();

然后在创建预制件后使用调用父游戏对象脚本中的public class StudentService : IStudentService { public void DoWork() { } } 方法。我似乎无法将UI Canvas定位在与其父对象相同的位置。请参阅下面的Canvas及其子对象的检查器设置图像。我怎样才能将它们放在同一个地方?

UI Canvas Prefab Inspector设置 enter image description here

UI Canvas Prefab儿童游戏对象检查器设置 enter image description here

1 个答案:

答案 0 :(得分:0)

您可以尝试将RenderMode指定给世界空间。