unity

How do I toggle a checkbox in Unity with code?

匿名 (未验证) 提交于 2019-12-03 02:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I looked at the Toggle API and can't find a way to set it to checked with code. http://docs.unity3d.com/ScriptReference/UI.Toggle.html The reason I want to do it is that I want to set a checkbox as checked depending on a setting when the game starts. Any ideas on how to do this? Thanks! 回答1: http://docs.unity3d.com/ScriptReference/UI.Toggle-isOn.html Use the public variable Toggle.isOn . Set it to true like this: myToggle.isOn = true; . You probably looked for a method, but don't forget to also look at the public variables, as these are part

Program Issues Going From Unity To HoloLens - Cannot convert from 'string' to 'System.IO.Stream'

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a program written in Unity using C# that initializes a new StreamReader and proceeds to read the text data from a text file I have stored in Unity's resources folder. Everything works fine when I click play in Unity -everything works and the text is read and displayed perfectly. However, when I try to build it in order to run it via the HoloLens emulator (Platform: Windows Store, SDK: Universal 10, Build and Run On: Local Machine), I get the error: error CS1503: Argument 1: cannot convert from 'string' to 'System.IO.Stream'. I don't

Unity将来时:IL2CPP是什么?

喜夏-厌秋 提交于 2019-12-03 02:30:54
Unity3D 想必大家都不陌生,独立游戏制作者们很多人都在用它,甚至一些大公司也用在很商业的游戏制作上。Unity3D最大的一个特点是一次制作,多平台部署,而 这一核心功能是靠Mono实现的。可以说Mono是Unity3D核心的核心,是Unity3D跨平台的根本。但是在2014年年中的时 候,Unity3D官方博客上却发了一篇“ The future of scripting in unity ”的文章,引出了IL2CPP的概念,感觉有取代Mono之势。那什么是IL2CPP,它能为Unity3D和作为使用Unity3D的我们带来哪些好处和改变?这就是本文尝试说明的。 C#,.Net Framework 我 们先说说IL2CPP试图取代的Mono。在说Mono之前,不得不提C#语言和背后的.Net Framework。C#是微软推出的一种基于.NET框架的、面向对象的高级编程语言。C#的发音为“see sharp”,模仿音乐上的音名“C♯”(C调升),是C语言的升级的意思。其正确写法应和音名一样为“C♯”。C#由C语言和C++派生而来,继承了其 强大的性能,同时又以.NET框架类库作为基础,拥有类似Visual Basic的快速开发能力。C#由安德斯·海尔斯伯格主持开发,微软在2000年发布了这种语言。说到安德斯·海尔斯伯格这里要多说一句,当年和VC(注 意,是VC

Unity: How to dynamically attach an unknown script to a GameObject (custom editor)

匿名 (未验证) 提交于 2019-12-03 02:28:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm currently making a system for the Unity Editor (custom inspector and custom windows) that will automate and make things easier for the artists working on the game we're making, but I've hit a brick wall. I'm trying to find a way to dynamically add, through an editor Textfield input and a GUI button, an unknown script to a gameobject in the scene. The artist/programmer will type the name of the script in the textfield and it will search and add to a gameobject, but I don't know how to proceed with this, specially since some functions of

Activation error occured while trying to get instance of type ICacheManager, key “Cache Manager”

匿名 (未验证) 提交于 2019-12-03 02:24:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I seem to have hit a wall here and would appreciate some help from anyone who is able to on this one. I am not exactly sure what the error message below means. I am using the Caching Block of Enterprise Pattern Services but I keep running in to the problem below. I downloaded the latest version and tried stepping through to the issue but I can't seem to pin the exact problem and I need help please. Thanks in advance Test method WorldBank.Service.Business.UnitTest.TopicsManagerTest.Call_Children_out_of_schoolTest threw exception: Microsoft

Unity and ASP.NET WebForms - No parameterless constructor defined for this object

匿名 (未验证) 提交于 2019-12-03 02:18:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Does anyone have any good examples of how to make Unity 1.2 or 2.0 work with ASP.NET WebForms? I thought I had this figured out, but evidently I'm missing something. Now I'm getting the error; "No parameterless constructor defined for this object". I remember getting this error a couple years ago, I and just don't remember what I did. Obviously Unity isn't working as it should because somewhere along the way I've forgotten something. Any help would be appreciated. Here's some of my code: Global.asax using System ; using System .

Unity Error: Unable to convert classes into dex format

匿名 (未验证) 提交于 2019-12-03 02:16:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have created an Android Unity plugin (.aar file) which provides some custom positioning data to my Unity game. In my Unity script, I use, var x = customClass.CallStatic<float>("getHeadX"); In order to get some location data. This method is called per frame to get the updated data (polling method) which makes it inefficient. Instead, I decided to call a C# method in my Unity script from my java code (plugin side) when the updated data is ready. To do this, in my java plugin, I wrote, import com.unity3d.player.UnityPlayer; ... UnityPlayer

Unity: Implicit ResolvedParameter for unnamed registrations

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The UserService constructor has two parameters, a IUnitOfWork and a IUserRepository : public UserService(IUnitOfWork unitofWork, IUserRepository userRepository) { ... } I am using named registrations to differentiate between multiple instances of IUnitOfWork , so when registering the UserService with the Unity container, I need to explicitly specify the parameters using an InjectionConstructor : container.RegisterType<IUserService, UserService>( new InjectionConstructor( new ResolvedParameter<IUnitOfWork>("someContext"), new

Register IAuthenticationManager with Unity

匿名 (未验证) 提交于 2019-12-03 02:13:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm using Unity for Dependencies Injection and using Identiy Provider to manage the user login, register, email confirmation, etc. When I try to register a user, I have this problem: The current type, Microsoft.Owin.Security.IAuthenticationManager, is an interface and cannot be constructed. Are you missing a type mapping? I have no idea how to register this Interface (IAuthenticationManager) in my Unity container. I tried registering the interface with this code, but if I put it, I have other problem: No IUserTokenProvider is