using UnityEditor;using System.IO;publicclassCreateAssetBundles//进行AssetBundle打包{[MenuItem("Assets/Build AssetBundles")]staticvoidBuildAllAssetBundles(){string dir="AssetBundles";if(Directory.Exists(dir)==false){Directory.CreateDirectory(dir);}BuildPipeline.BuildAssetBundles(dir,//路径必须创建BuildAs...
{//需要本地化的Textif(textComponent.gameObject.GetComponent<LocalizeStringEvent>() ==null) { LocalizeStringEvent localizeEvent= textComponent.gameObject.AddComponent<LocalizeStringEvent>();//标记对象为“已修改”EditorUtility.SetDirty(selectedObject); }//添加到列表stringentry = $"{selectedObject.name}...
if (!elementMark.GetComponent(GeneratorData.GetType(elementMark.CustomComponentName))) { elementMark.gameObject.AddComponent(GeneratorData.GetType(elementMark.CustomComponentName)); UnityEngine.Object.DestroyImmediate(elementMark); } }); }); Debug.Log(tt+12344); } 1. 2. 3. 4. 5. 6. 7. 8. ...
void Process(Entity entity, ComponentDataFromEntity<ItemTag> items) { if( items.Exists(entity)) { PostUpdateCommands.DestroyEntity(entity); UnityEngine.Debug.Log("you get item!"); } } } 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. ...
Throws an exception at // playback if the entity doesn't already have a MyElement buffer. // ecb.AddComponent<MyElement>(otherEntity) is a safe way to ensure a buffer // exists before appending to it. ecb.AppendToBuffer(otherEntity, new MyElement { Value = 12 }); } Reinterpret a ...
Audio To hear sound, you need an Audio Listener component, which already exists on any camera by default. To play a sound, simply add an Audio Source component to a game object and set the audio clip. Unity supports most major audio formats and will encode longer clips to MP3. If you ...
Emitter VelocityChoose how the Particle System calculates the velocity used by the Inherit Velocity and Emission modules. The system can calculate the velocity using a Rigidbody component, if one exists, or by tracking the movement of the Transform component. If no Rigidbody component exists, the...
If I drag and drop this code onto another GameObject, a completely separate instance of that code component gets instantiated. This is a basic example and it can be made more efficient by, say, adding a RigidBody component to this object, but I’ll keep it simple here. Figure 9 The ...
TryGetComponentGets the component of the specified type, if it exists. GetInstanceIDGets the instance ID of the object. ToStringReturns the name of the object. GetClosestReflectionProbesReturns an array of closest reflection probes with weights, weight shows how much influence the probe has on the...
IO; public class CreateAssetBundles //进行AssetBundle打包 { [MenuItem("Assets/Build AssetBundles")] static void BuildAllAssetBundles() { string dir = "AssetBundles"; if (Directory.Exists(dir) == false) { Directory.CreateDirectory(dir); } BuildPipeline.BuildAssetBundles(dir, //路径必须创建 ...