armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

1. ## Erarnitox

Member

7

• ### Content Count

349

2. ## geckoo

Moderators

6

• ### Content Count

2,818

3. ## OneManArmy

3

• ### Content Count

3,983

4. 1

3,888

## Popular Content

Showing content with the highest reputation since 06/19/2019 in all areas

1. 2 points
STR!PES is my entry for the 44th LudumDare. This is a procedural game. In my project there is only code - some procedural generation for shapes and stripes - no sprite, no prefab, no physics, no implicite value (excepted a radius PI). I optimized each part of code so as to reach the lowest execution using a simple (but efficient) pooling system and an improved implementation of coroutine. Also I use a leaderboard on-line so as to save best scores. Take a look at the video below. STR!PES is available for free on Itch.io ++
2. 1 point
3. 1 point
4. 1 point
yeah its actually very simple to do but here you go: using UnityEngine; public class Peek : MonoBehaviour { public Transform cam; public Transform cam2; private float nextPos; private float nextPos2; private float dampVelocity; private float dampVelocity2; void Update() { float newPos = Mathf.SmoothDamp(cam.transform.localPosition.x, nextPos, ref this.dampVelocity, 0.2f); float newPos2 = Mathf.SmoothDamp(cam.transform.localPosition.y, nextPos2, ref this.dampVelocity2, 0.2f); float newPos3 = Mathf.SmoothDamp(cam2.transform.localPosition.x, nextPos, ref this.dampVelocity, 0.2f); float newPos4 = Mathf.SmoothDamp(cam2.transform.localPosition.y, nextPos2, ref this.dampVelocity2, 0.2f); cam.transform.localPosition = new Vector3(newPos, newPos2, cam.transform.localPosition.z); cam2.transform.localPosition = new Vector3(newPos3, newPos4, cam2.transform.localPosition.z); if (Input.GetKey("x")) { nextPos = 0.7f; nextPos2 = 0.0f; } else if (Input.GetKey("z")) { nextPos = -0.7f; nextPos2 = 0.0f; } else if (Input.GetKey("c")) { nextPos = 0.0f; nextPos2 = 0.0f; } else { nextPos = 0.0f; nextPos2 = 0.0f; } } /* [RPC] //Rpcs are not supported anymore since raknet got removed from unity use UNET or some other networking soulution (TNet is like raknet if you want a quick convert) void Test() {} */ } by the way i would not use the code the way it is it looks hacked together and will be pretty inperformant. Also there are no Remote procedure calls like that anymore, if you want to have networked methods you have to do it differently, wrote a quick comment on the side.
5. 1 point
The same, but allowing to create a background. Create an empty gameobject and put this script on it ++ using System.Collections; using UnityEngine; // convert time to sprite [RequireComponent(typeof(SpriteRenderer))] public class TimeToSprite : MonoBehaviour { Texture2D mTex; private Sprite mySprite; // sprite size which can be using like a fontSize [Range(1, 10)] public int fontSize = 5; // font and background color public Color _color = Color.red; public Color _background = Color.black; // each number use 5x3 pixels + 1 as space between them int marging = 4; // size int width; int height = 7; // five pixel + two for contour float time; // for deltaTime string str; // time as string string[] sChars = new string[] { "x", "x", "x", "x" }; // saved chars // each column will be displayed according a bit code int[] num0 = new int[] { 31, 17, 31 }; int[] num1 = new int[] { 17, 31, 16 }; int[] num2 = new int[] { 29, 21, 23 }; int[] num3 = new int[] { 21, 21, 31 }; int[] num4 = new int[] { 07, 04, 31 }; int[] num5 = new int[] { 23, 21, 29 }; int[] num6 = new int[] { 31, 21, 29 }; int[] num7 = new int[] { 01, 01, 31 }; int[] num8 = new int[] { 31, 21, 31 }; int[] num9 = new int[] { 23, 21, 31 }; int[] _dot = new int[] { 00, 10, 00 }; void Awake() { this.transform.localScale = new Vector3(fontSize, fontSize, 0); width = ((4 * marging) + 1); // because we use only 4 chars - 00.0 if (mTex == null) mTex = new Texture2D(width, height, TextureFormat.ARGB32, true); mTex.wrapMode = TextureWrapMode.Clamp; mTex.filterMode = FilterMode.Point; // pixel it mTex.Apply(); this.GetComponent<SpriteRenderer>().flipX = false; this.GetComponent<SpriteRenderer>().flipY = true; // fill sprite with background color for (int i = 0; i < height; i++) for (int j = 0; j < width; j++) mTex.SetPixel(j, i, _background); } // clear only concerned part of the sprite according a new pattern void refresh(int shift) { int x = 1; // a value to center process (one pixel inside sprite) for (int i = x; i < height - x; i++) for (int j = x; j < marging; j++) mTex.SetPixel(j + shift, i, _background); } void UpdateTexture() { mTex.Apply(); // apply new texture as sprite after modification var mySprite = Sprite.Create(mTex, new Rect(0.0f, 0.0f, mTex.width, mTex.height), new Vector2(0.5f, 0.5f), 100.0f, (uint)0); this.transform.GetComponent<SpriteRenderer>().sprite = mySprite; } void timer() { // we use only one digit str = time.ToString("00.0").Replace(",", "."); for (int i = 0; i < str.Length; i++) { // check if the new number is the same (or not) than the previous if (str.Substring(i, 1) != sChars[i]) { // erase the previous pixel zone for this index refresh(i * marging); if (str.Substring(i, 1) == "0") pencil(i * marging, num0, _color); else if (str.Substring(i, 1) == "1") pencil(i * marging, num1, _color); else if (str.Substring(i, 1) == "2") pencil(i * marging, num2, _color); else if (str.Substring(i, 1) == "3") pencil(i * marging, num3, _color); else if (str.Substring(i, 1) == "4") pencil(i * marging, num4, _color); else if (str.Substring(i, 1) == "5") pencil(i * marging, num5, _color); else if (str.Substring(i, 1) == "6") pencil(i * marging, num6, _color); else if (str.Substring(i, 1) == "7") pencil(i * marging, num7, _color); else if (str.Substring(i, 1) == "8") pencil(i * marging, num8, _color); else if (str.Substring(i, 1) == "9") pencil(i * marging, num9, _color); else if (str.Substring(i, 1) == ".") pencil(i * marging, _dot, _color); } // save the char at its index so as to compare it with the next sequence sChars[i] = str.Substring(i, 1); } // update our texture UpdateTexture(); } // convert a number as a bool array private bool[] ConvertByteToBoolArray(byte b) { bool[] r = null; r = new bool[height]; // don't read all bit for (int i = 0; i < r.Length; i++) r[i] = (b & (1 << i)) == 0 ? false : true; return r; } void pencil(int shift, int[] seq, Color color) { // read each integer as pixels column for (int i = 0; i < seq.Length; i++) { var lol = (byte)seq[i]; var ss = ConvertByteToBoolArray(lol); // read bool array to know where a black pixel must be displayed for (int j = 0; j < height; j++) if (ss[j] == true) mTex.SetPixel((shift + i) + 1, j + 1, color); } } ////////////////////////////////////////////////////////// // as an example, we show deltaTime IEnumerator Start() { timer(); while (true) { yield return new WaitForSeconds(0.09f); timer(); } } private void Update() { time += Time.deltaTime; // set max if (time >= 99.9f) time = 99.9f; } }
6. 1 point
Displaying a text on screen, usually we create a canvas as UI and it works very well on Unity. However I wanted to code a script which could apply a text or a value as a sprite - in other words, I tried to create an alternative UI, setting some features, creating my own font, etc. As an example, the basical code below allows to display time.deltaTime, checking values, applying modification, reading an array of booleans (according an integer) so as to paint some pixels on sprite (5*3). Also it could be used on a weapon so as to show how many bullets are available in the cartridge or maybe for health, and more. Simply put it on a game object. I hope that it will be useful someone ++ using System.Collections; using UnityEngine; // convert time to sprite [RequireComponent(typeof(SpriteRenderer))] public class TimeToSprite : MonoBehaviour { Texture2D mTex; private Sprite mySprite; // sprite size which can be using like a fontSize [Range(1, 10)] public int fontSize = 5; // font color public Color _color = Color.black; // each number use 5x3 pixels + 1 as space between them int marging = 4; // size int width; int height = 5; // five pixel float time; // for deltaTime string str; // time as string string[] sChars = new string[] { "x", "x", "x", "x" }; // saved chars // each column will be displayed according a bit code int[] num0 = new int[] { 31, 17, 31 }; int[] num1 = new int[] { 17, 31, 16 }; int[] num2 = new int[] { 29, 21, 23 }; int[] num3 = new int[] { 21, 21, 31 }; int[] num4 = new int[] { 07, 04, 31 }; int[] num5 = new int[] { 23, 21, 29 }; int[] num6 = new int[] { 31, 21, 29 }; int[] num7 = new int[] { 01, 01, 31 }; int[] num8 = new int[] { 31, 21, 31 }; int[] num9 = new int[] { 23, 21, 31 }; int[] _dot = new int[] { 00, 16, 00 }; void Awake() { this.transform.localScale = new Vector3(fontSize, fontSize, 0); width = ((4 * marging) - 1); // because we use only 4 chars - 00.0 if (mTex == null) mTex = new Texture2D(width, height, TextureFormat.ARGB32, true); mTex.wrapMode = TextureWrapMode.Clamp; mTex.filterMode = FilterMode.Point; // pixel it mTex.Apply(); this.GetComponent<SpriteRenderer>().flipX = false; this.GetComponent<SpriteRenderer>().flipY = true; } // clear some part of the sprite according a new pattern void refresh(int shift) { for (int i = 0; i < height; i++) for (int j = 0; j < marging; j++) mTex.SetPixel(j + shift, i, Color.clear); } void UpdateTexture() { mTex.Apply(); // apply new texture as sprite after modification var mySprite = Sprite.Create(mTex, new Rect(0.0f, 0.0f, mTex.width, mTex.height), new Vector2(0.5f, 0.5f), 100.0f, (uint)0); this.transform.GetComponent<SpriteRenderer>().sprite = mySprite; } void timer() { // we use only one digit str = time.ToString("00.0"); for (int i = 0; i < str.Length; i++) { // check if the new number is the same (or not) than the previous if (str.Substring(i, 1) != sChars[i]) { // erase the previous pixel zone for this index refresh(i * marging); if (str.Substring(i, 1) == "0") pencil(i * marging, num0, _color); else if (str.Substring(i, 1) == "1") pencil(i * marging, num1, _color); else if (str.Substring(i, 1) == "2") pencil(i * marging, num2, _color); else if (str.Substring(i, 1) == "3") pencil(i * marging, num3, _color); else if (str.Substring(i, 1) == "4") pencil(i * marging, num4, _color); else if (str.Substring(i, 1) == "5") pencil(i * marging, num5, _color); else if (str.Substring(i, 1) == "6") pencil(i * marging, num6, _color); else if (str.Substring(i, 1) == "7") pencil(i * marging, num7, _color); else if (str.Substring(i, 1) == "8") pencil(i * marging, num8, _color); else if (str.Substring(i, 1) == "9") pencil(i * marging, num9, _color); else if (str.Substring(i, 1) == ".") pencil(i * marging, _dot, _color); } // save the char at its index so as to compare it with the next sequence sChars[i] = str.Substring(i, 1); } // update our texture UpdateTexture(); } // convert a number as a bool array private bool[] ConvertByteToBoolArray(byte b) { bool[] r = null; r = new bool[height]; // don't read all bit for (int i = 0; i < r.Length; i++) r[i] = (b & (1 << i)) == 0 ? false : true; return r; } void pencil(int shift, int[] seq, Color color) { // read each integer as pixels column for (int i = 0; i < seq.Length; i++) { var lol = (byte)seq[i]; var ss = ConvertByteToBoolArray(lol); // read bool array to know where a black pixel must be displayed for (int j = 0; j < height; j++) if (ss[j] == true) mTex.SetPixel(shift + i, j, color); } } ////////////////////////////////////////////////////////// // as an example, we show deltaTime IEnumerator Start() { timer(); while (true) { yield return new WaitForSeconds(0.09f); timer(); } } private void Update() { time += Time.deltaTime; // set max if (time >= 99.9f) time = 99.9f; } }
7. 1 point
yeah, but i dont think that was the problem ... but i have no idea what might be
8. 1 point ## disable multiple skin mesh renderer at once

show us code you used with GetComponentsInChildren. Personally i wouldn't use GetComponentsInChildren, if it will be used often.
9. 1 point
which is wrong with mine using UnityEngine; using System.Collections; public class DamageIndicator : MonoBehaviour { /// <summary> /// Attack from direction /// </summary> [HideInInspector] public Vector3 attackDirection; /// <summary> /// time reach for fade arrow /// </summary> public float FadeTime = 3; public Texture damageIndicatorTexture; public Color ArrowColor = new Color(0.85f, 0, 0); /// <summary> /// the transform root of player /// </summary> public GameObject target; //Private public Vector2 pivotPoint; public float alpha = 0.0f; public float offset = 350f; public float rotationOffset; /// <summary> /// /// </summary> void OnGUI() { if (this.alpha > 0) { this.offset = Screen.height / 4; GUI.color = new Color(ArrowColor.r, ArrowColor.g, ArrowColor.b, this.alpha); Vector2 vector = new Vector2(((Screen.width / 2) - (this.damageIndicatorTexture.width / 2)), (Screen.height / 2) - this.offset); this.pivotPoint = new Vector2((Screen.width / 2), (Screen.height / 2)); GUIUtility.RotateAroundPivot(this.rotationOffset, this.pivotPoint); GUI.DrawTexture(new Rect(vector.x, vector.y, this.damageIndicatorTexture.width, this.damageIndicatorTexture.height), this.damageIndicatorTexture); } } /// <summary> /// Use this to send a new direction of attack /// </summary> /// <param name="dir">postion of attacker</param> public void AttackFrom(Vector3 dir) { //target = this.transform ; this.attackDirection = dir; this.alpha = 3f; } /// <summary> /// if this is visible Update position /// </summary> void Update() { // Player Clone integration Start if (target == null) if (GameObject.Find("Player")) target = GameObject.Find("Player"); // player clone integration end if (this.alpha > 0) { this.alpha -= Time.deltaTime; this.UpdateDirection(); } } /// <summary> /// update direction as the arrow shows /// </summary> void UpdateDirection() { Vector3 rhs = this.attackDirection - this.target.transform.position; rhs.y = 0; rhs.Normalize(); Vector3 forward; if (Camera.main != null) { forward = Camera.main.transform.forward; } else { if (Camera.current != null) { forward = Camera.current.transform.forward; } else { forward = this.transform.forward; } } float GetPos = Vector3.Dot(forward, rhs); if (Vector3.Cross(forward, rhs).y > 0) { this.rotationOffset = (1f - GetPos) * 90; } else { this.rotationOffset = (1f - GetPos) * -90; } } }
10. 1 point
so yeah thats why in weapon manager disable the text right before you switch to the next weapon and after you disabled the old one
11. 1 point
but there are values of adjust that work? most likely nothing to do with adjust but rather disabeling something when you pick up that doesnt get enabled again when you drop or sth. like that. Im actually sorry i couldnt spot sth. at first sight... also im not quite positive if i got you correctly ... i know its annoying but a video of the issue really helps me understand things also i have sth. to do right now but will get back later
12. 1 point
yes, it should but i think this gets optimized at compile time to what i wrote anyways so its the same just easier to read when you leave that away
13. 1 point
1) create a new script and add it to the Player Obeject and/or Prefab in scene 2) write this into the script: public class Helper : MonoBehaviour{ public GrabObjects grabObjects; } 3) drag n drop "No Weapon" into the the grabobjects slot of that script 4) the new Pickable Script should look like this: using UnityEngine; using System.Collections; using System.Collections.Generic; using EasySurvivalScripts; public class Pickable : MonoBehaviour { //[Header("JC LEON Other Scripts References Integrations")] private GrabObjects grabObjects; private TextAnimator textAnimator; [SerializeField] private string MyMessage; [Header("JC LEON Only Pickable Object Integration")] [Tooltip("thick to set object only pPickable and not Examinable")] public bool isPickableOnly;//ADDED JC LEON only pickup private void Start() { grabObjects = GameObject.FindWithTag("Player").GetComponent<Helper>().grabObjects; textAnimator = FindObjectOfType<TextAnimator>(); } public void ShowMessage() { textAnimator.Show(MyMessage); } void OnTriggerEnter(Collider otherCollider) { //If that GameObject is either static, without a rigidbody, or with a rigidbody that is also kinematic (in other words, that GameObject is not supposed to move)... //Then we call the ObjectCheck method. if (grabObjects.isGrabbing && grabObjects.GrabTime != 0.0f) { if (otherCollider.GetComponent<Collider>().gameObject.isStatic) { grabObjects.GetComponent<GrabObjects>().Drop(); Debug.Log("ciao"); } else if (otherCollider.GetComponent<Collider>().gameObject.GetComponent<Rigidbody>() == null) { grabObjects.Drop(); Debug.Log("ciao"); } else if (otherCollider.GetComponent<Collider>().gameObject.GetComponent<Rigidbody>()) { grabObjects.Drop(); Debug.Log("ciao"); } else if (otherCollider.GetComponent<Collider>().gameObject.GetComponent<Rigidbody>().isKinematic == true) { grabObjects.Drop(); Debug.Log("ciao"); } } } } 5) test it ... not sure if that will work but i think that was the problem 6) mark this as best answer (if it works, else call me stupid or sth. )
14. 1 point
lol I forgot India banned 18+ content thats why couldnt load chaturbate to check oout the games, proxy to the rescue
15. 1 point
No, I’m actually friends with a lot of pornstars and escort services bc I used to do a lot of there photography. But making visual game you can make it and throw up a price if you want and inform the stars on sites like ManyVids live. Sites like manyvids don’t have games built into there chat rooms so if they see games they can use, normally they will take it if offered. You can also ask a retweet group leader like @theserenitykay or @strawbryshrtck3 to tweet a link+game picture. Retweet groups are basically huge groups of porn models that retweet each other’s stuff to get there content noticed. Those 2 girls run retweet groups for manyvids. Telling them you will purchase content or add links to there content in the game may also increase your chances of them saying yes. But all depends on the quality of the game. For built in games using there chat CLICK HERE FOR API, chaturbate gets a ton of traffic and offers a text based game api for there chat rooms that you can sell for models essentially every game is just a list of prizes (what they do) and your game just randomly chooses an index in that list. That’s it. Then it’s just a matter of making it fun
16. 1 point
(The next video will be in English!) Hey, guys at the moment I learn to program at school and while I'm doing this I decided to create my own game. I hope you will join the journey!
17. 1 point
The same script but with another font - 7*5 pixels ++ using System.Collections; using UnityEngine; // convert time to sprite [RequireComponent(typeof(SpriteRenderer))] public class TimeToSprite : MonoBehaviour { Texture2D mTex; private Sprite mySprite; // sprite size which can be using like a fontSize [Range(1, 10)] public int fontSize = 5; // font color public Color _color = Color.black; // each number use 7x5 pixels + 1 as space between them int marging = 6; // size int width; int height = 7; // seven pixel float time; // for deltaTime string str; // time as string string[] sChars = new string[] { "x", "x", "x", "x" }; // saved chars // each column will be displayed according a bit code int[] num0 = new int[] { 127, 65, 73, 65, 127 }; int[] num1 = new int[] { 65, 65, 127, 64, 64 }; int[] num2 = new int[] { 121, 73, 73, 73, 79 }; int[] num3 = new int[] { 73, 73, 73, 73, 127 }; int[] num4 = new int[] { 15, 8, 8, 8, 127 }; int[] num5 = new int[] { 79, 73, 73, 73, 121 }; int[] num6 = new int[] { 127, 73, 73, 73, 121 }; int[] num7 = new int[] { 1, 1, 1, 1, 127 }; int[] num8 = new int[] { 127, 73, 73, 73, 127 }; int[] num9 = new int[] { 79, 73, 73, 73, 127 }; int[] _dot = new int[] { 0, 0, 64, 0, 0 }; void Awake() { this.transform.localScale = new Vector3(fontSize, fontSize, 0); width = ((4 * marging) - 1); // because we use only 4 chars - 00.0 if (mTex == null) mTex = new Texture2D(width, height, TextureFormat.ARGB32, true); mTex.wrapMode = TextureWrapMode.Clamp; mTex.filterMode = FilterMode.Point; // pixel it mTex.Apply(); this.GetComponent<SpriteRenderer>().flipX = false; this.GetComponent<SpriteRenderer>().flipY = true; } // clear some part of the sprite according a new pattern void refresh(int shift) { for (int i = 0; i < height; i++) for (int j = 0; j < marging; j++) mTex.SetPixel(j + shift, i, Color.clear); } void UpdateTexture() { mTex.Apply(); // apply new texture as sprite after modification var mySprite = Sprite.Create(mTex, new Rect(0.0f, 0.0f, mTex.width, mTex.height), new Vector2(0.5f, 0.5f), 100.0f, (uint)0); this.transform.GetComponent<SpriteRenderer>().sprite = mySprite; } void timer() { // we use only one digit str = time.ToString("00.0"); for (int i = 0; i < str.Length; i++) { // check if the new number is the same (or not) than the previous if (str.Substring(i, 1) != sChars[i]) { // erase the previous pixel zone for this index refresh(i * marging); if (str.Substring(i, 1) == "0") pencil(i * marging, num0, _color); else if (str.Substring(i, 1) == "1") pencil(i * marging, num1, _color); else if (str.Substring(i, 1) == "2") pencil(i * marging, num2, _color); else if (str.Substring(i, 1) == "3") pencil(i * marging, num3, _color); else if (str.Substring(i, 1) == "4") pencil(i * marging, num4, _color); else if (str.Substring(i, 1) == "5") pencil(i * marging, num5, _color); else if (str.Substring(i, 1) == "6") pencil(i * marging, num6, _color); else if (str.Substring(i, 1) == "7") pencil(i * marging, num7, _color); else if (str.Substring(i, 1) == "8") pencil(i * marging, num8, _color); else if (str.Substring(i, 1) == "9") pencil(i * marging, num9, _color); else if (str.Substring(i, 1) == ".") pencil(i * marging, _dot, _color); } // save the char at its index so as to compare it with the next sequence sChars[i] = str.Substring(i, 1); } // update our texture UpdateTexture(); } // convert a number as a bool array private bool[] ConvertByteToBoolArray(byte b) { bool[] r = null; r = new bool[height]; for (int i = 0; i < r.Length; i++) r[i] = (b & (1 << i)) == 0 ? false : true; return r; } void pencil(int shift, int[] seq, Color color) { // read each integer as pixels column for (int i = 0; i < seq.Length; i++) { var lol = (byte)seq[i]; var ss = ConvertByteToBoolArray(lol); // read bool array to know where a black pixel must be displayed for (int j = 0; j < height; j++) if (ss[j] == true) mTex.SetPixel(shift + i, j, color); } } ////////////////////////////////////////////////////////// // as an example, we show deltaTime IEnumerator Start() { timer(); while (true) { yield return new WaitForSeconds(0.09f); timer(); } } private void Update() { time += Time.deltaTime; // set max if (time >= 99.9f) time = 99.9f; } }
18. 1 point
Bullshit! Respectfully I understand what meant your cousin, but honestly I have a doubt about his skill regarding this question. I could argue a few hours with you, but I prefer only quote some games which are good - and bankable - if you think that you need money developing your own projects : SuperHot, FireWatch, LayersOfFear, CupHead, TheRoom, MonumentValley, BroForce, Poney Island, SolarGun, Inside, HandOfFaith, Endless Space2, SubNautica, and more more more. I played almost all games which I quoted previously - and they are really good - better than some sh** which had been released using Unreal Engine Maybe Unity is not the best, the most beautiful, efficient or something else - OK (I don't agree), but it is not the least. I cannot imagine myself working on another engine. Take a look at the link below and you can see that many interesting games (\$\$\$) have been developed under Unity. Considering all efforts that the Unity team does today so as to increase quality and power of their engine, I guess that the future will be amazing for Unity and its community ++ https://en.wikipedia.org/wiki/List_of_Unity_games
19. 1 point 